Plate 58
Topic
python
50 posts
Plate 57
memoryview vs bytes Slice: Localhost Lab
Plate 82
shlex.split vs str.split: Localhost Lab
Plate 17
platform vs os.uname Inventory: Localhost Lab
Hands-on platform.platform vs os.uname host inventory lab: real ops/s plus cache notes, measured on Linux localhost today in this hands-on lab for SREs.
Plate 34
ast.literal_eval vs json.loads: Localhost Lab
Plate 64
selectors vs select.select: Localhost Lab
Plate 50
signal vs threading.Event Wakeup: Localhost Lab
Hands-on signal SIGUSR1 vs threading.Event wakeup lab: real p50 latency in microseconds, measured on Linux localhost today in this hands-on lab for SREs.
Plate 76
cmath vs math.hypot Magnitudes: Localhost Lab
Hands-on cmath vs math.hypot magnitude ops lab: real ops/s for abs, polar, and phase, measured on Linux localhost today in this hands-on lab for SREs.
Plate 59
enum.IntEnum vs int Status Codes: Localhost Lab
Plate 90
Path.read_text vs open().read: Localhost Lab
Plate 51
tracemalloc Snapshot Cost: Localhost Lab
Plate 09
dataclasses.asdict vs vars: Localhost Lab
Plate 68
gc.collect Cost Empty vs Cycles: Localhost Lab
Hands-on gc.collect cost empty vs cyclic garbage lab: real collect latency plus reclaim counts, measured on Linux localhost today in this lab for SREs.
Plate 28
sqlite3 vs shelve Local KV: Localhost Lab
Hands-on sqlite3 vs shelve local KV store lab: real insert/get ops/s plus file sizes, measured on Linux localhost today in this hands-on lab for SREs.
Plate 76
html.parser vs regex Tag Strip: Localhost Lab
Plate 43
copy.copy vs dict.copy Shallow: Localhost Lab
Plate 85
math.fsum vs sum Float Totals: Localhost Lab
Hands-on math.fsum vs builtin sum for float totals: real items/s plus cancellation accuracy, measured on Linux localhost in this hands-on lab for SREs.
Plate 77
fractions.Fraction vs float: Localhost Lab
Hands-on fractions.Fraction vs float for exact ratios: real ops/s and exactness checks, measured on Linux localhost today in this hands-on lab for SREs.
Plate 16
ExitStack vs Nested with Resources: Localhost Lab
Hands-on contextlib.ExitStack vs nested with and manual close: real cycles/s for N resources, measured on Linux localhost in this hands-on lab for SREs.
Plate 40
itertools.batched vs Manual Chunking: Localhost Lab
Hands-on itertools.batched vs manual list-slice chunking: real items/s batching sequences, measured on Linux localhost today in this hands-on lab for SREs.
Plate 35
ipaddress vs String Prefix Allowlist: Localhost Lab
Hands-on ipaddress CIDR containment vs naive string prefix allowlists: real checks/s, measured on Linux localhost today in this hands-on lab for SREs.
Plate 12
ChainMap vs Merged Dict Lookup: Localhost Lab
Hands-on collections.ChainMap vs merged dict config lookup: real ops/s on layered keys, measured on Linux localhost today in this hands-on lab for SREs.
Plate 29
functools.cache vs lru_cache(None): Localhost Lab
Plate 94
graphlib Topo vs Manual Kahn: Localhost Lab
Plate 92
StringIO vs list-join Builder: Localhost Lab
Plate 96
Queue vs deque Threaded Handoff: Localhost Lab
Plate 17
subprocess.run vs Popen: Localhost Lab
A measured Linux localhost lab comparing subprocess.run with Popen and communicate for tiny process spawns and captured stdout.
Plate 64
shelve vs pickle Dict Store: Localhost Lab
A measured Linux localhost lab comparing shelve's keyed dbm store with a single pickle blob for full snapshots and random access.
Plate 18
fnmatch vs re Name Filter: Localhost Lab
Hands-on fnmatch.filter vs re.compile name-list filtering measured on Linux localhost.
Plate 84
tarfile vs zipfile Create+Extract: Localhost Lab
Hands-on tarfile vs zipfile create+extract lab: real MB/s on a mixed small-file fixture (uncompressed tar vs zip), measured on Linux localhost for SREs.
Plate 85
scandir vs listdir vs iterdir: Localhost Lab
Hands-on os.scandir vs listdir vs Path.iterdir lab: real entries/s for names and is_file on a synthetic tree, measured on Linux localhost (lab) for SREs.
Plate 06
pickle vs json: Round-trip Lab
Hands-on pickle vs json local round-trip lab: real throughput and size for modest dict/list payloads (trusted data), measured on Linux localhost (lab).
Plate 04
csv.reader vs split: Parse Lab
Hands-on csv.reader vs str.split vs DictReader lab: real rows/s on a quoted-field CSV fixture (pandas-free parse), measured on Linux localhost for SREs.
Plate 41
hashlib md5 vs blake2b: Checksum Lab
Hands-on hashlib md5 vs blake2b vs sha1/sha256 lab: real MB/s checksum throughput for content-integrity hashing, measured on Linux localhost for SREs.
Plate 28
glob vs rglob vs os.walk: Listing Lab
Hands-on glob.glob vs Path.rglob vs os.walk lab: real files/s for recursive file listing on a modest fixture tree, measured on Linux localhost for SREs.
Plate 78
json.dumps Compact vs Indent Lab
Hands-on json.dumps separators vs indent lab: real time and byte-size tradeoffs for compact vs pretty JSON encoding, measured on Linux localhost (lab).
Plate 41
shutil.copyfile vs Manual Copy Lab
Hands-on shutil.copyfile vs manual file copy lab: real MB/s versus open/read/write and Path.read_bytes on local disk, measured on Linux localhost (lab).
Plate 22
str.translate vs replace: Scrub Lab
Hands-on str.translate vs replace vs re.sub lab: real ops/s for character delete and map scrubbing on mid-size strings, measured on Linux localhost (lab).
Plate 46
setdefault vs defaultdict: Insert Lab
Hands-on setdefault vs if-not-in vs defaultdict lab: real ops/s for list-append and counter default insert patterns, measured on Linux localhost (lab).
Plate 18
zip vs Index Pairing: Loop Lab
Plate 08
functools.partial vs lambda: Call Lab
Plate 29
statistics vs Manual mean: Stdlib Lab
Hands-on statistics vs manual mean/median/stdev lab: real ops/s for fmean, sum/len, and sorted mid versus the stdlib, measured on Linux localhost (lab).
Plate 28
bisect vs Linear vs set: Lookup Lab
Hands-on bisect.insort vs linear vs set lab: real ops/s for mixed sorted-list insert and membership lookup workloads, measured on Linux localhost (lab).
Plate 67
itertools.chain vs Flatten Lab
Plate 12
nlargest vs sorted[:k]: Top-k Lab
Plate 15
attrgetter vs getattr: Hot Loop Lab
Hands-on operator.attrgetter vs builtin getattr lab: real ops/s for extract and sort by attribute versus direct access, measured on Linux localhost only.
Plate 45
Counter vs dict: Tally Lab
Hands-on collections.Counter vs dict tally lab: real ops/s for Counter.update, dict get-add, and defaultdict(int) token counting on Linux localhost (lab).
Plate 72
bytes vs bytearray: Mutate/Copy Lab
Hands-on bytes vs bytearray lab: real ops/s for append/extend/slice/copy and when copy dominates over mutate, benchmarked on Linux localhost for SREs.
Plate 77
contextlib vs try/finally: Cleanup Lab
Plate 92
TemporaryFile vs NamedTemporaryFile Delete Modes Lab
Hands-on tempfile modes lab: TemporaryFile vs NamedTemporaryFile delete True/False vs mkstemp unlink patterns with real measured ops/s on localhost box.