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.
Topic
102 posts
Plate 17
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 75
Hands-on uuid.uuid4 vs uuid.uuid1 ID generation lab: real ops/s plus version/node checks, measured on Linux localhost today in this hands-on lab for SREs.
Plate 50
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
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 51
Plate 09
Plate 47
Plate 15
Plate 44
Plate 94
Plate 95
Hands-on Path.glob vs os.listdir+fnmatch.filter one-dir lab: real matches/s on *.py files, measured on Linux localhost today in this hands-on lab for SREs.
Plate 95
Hands-on tomllib vs json.load nested config lab: real loads/s (stdlib TOML read-only), measured on Linux localhost today in this hands-on lab for SREs.
Plate 68
Hands-on zoneinfo.ZoneInfo vs fixed UTC offset conversions: real conv/s on many datetimes, measured on Linux localhost today in this hands-on lab for SREs.
Plate 57
Hands-on dataclasses.replace vs manual copy/new-instance lab: real ops/s updating one field, measured on Linux localhost in this hands-on lab for SREs.
Plate 12
Hands-on itertools.islice vs list slice window lab: real ops/s taking ranges from sequences, measured on Linux localhost in this hands-on lab for SREs.
Plate 07
Hands-on heapq.merge vs sorted(chain) multi-way merge: real records/s on pre-sorted lists, measured on Linux localhost today in this hands-on lab for SREs.
Plate 88
Hands-on mmap MAP_SHARED write+msync vs pwrite region update: real MB/s with durability labels, measured on Linux localhost in this hands-on lab for SREs.
Plate 58
Hands-on os.stat vs pathlib.Path.stat vs os.lstat: real metadata stats/s on many regular files, measured on Linux localhost in this hands-on lab for SREs.
Plate 71
A hands-on localhost lab comparing html.escape with chained str.replace for safe HTML escaping.
Plate 35
A hands-on localhost lab comparing configparser and json.load for nested application configuration.
Plate 17
Hands-on difflib.SequenceMatcher vs set Jaccard token similarity: real ops/s on token lists, measured on Linux localhost in this hands-on lab for SREs.
Plate 24
Hands-on zlib.compress vs gzip.compress same-level (6) stdlib bake-off: real MB/s and sizes, measured on Linux localhost in this hands-on lab for SREs.
Plate 61
Hands-on operator.methodcaller vs getattr vs direct: real calls/s invoking methods on many objects, measured on Linux localhost today in this lab for SREs.
Plate 58
Hands-on itertools.groupby vs manual dict-of-lists: real records/s grouping pre-sorted key runs, measured on Linux localhost today in this lab for SREs.
Plate 21
Hands-on argparse vs manual sys.argv parse lab: real parses/s for small CLI flag sets on fixed argv, measured on Linux localhost in this lab for SREs.
Plate 69
Hands-on hmac.compare_digest vs bytes == verify lab: real ops/s plus HMAC-SHA256 construct costs, measured on Linux localhost in this eng lab for SREs.
Plate 17
A measured Linux localhost lab comparing subprocess.run with Popen and communicate for tiny process spawns and captured stdout.
Plate 18
Hands-on fnmatch.filter vs re.compile name-list filtering measured on Linux localhost.
Plate 14
Hands-on concurrent.futures as_completed vs wait lab with measured completion timing on Linux localhost.
Plate 84
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
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 23
Plate 09
Plate 28
BytesIO vs SpooledTemporaryFile growth throughput across the spool threshold, compared with NamedTemporaryFile on Linux localhost.
Plate 68
WeakValueDictionary vs strong dict cache: insert and lookup throughput, plus GC-driven drop on Linux localhost.
Plate 63
Hands-on Decimal vs float cumulative sum lab: real ops/s plus a simple accuracy note (not financial advice), measured on Linux localhost (lab) for SREs.
Plate 76
Hands-on threading.local vs tid-keyed dict vs module-global lab: real ops/s for per-thread state access patterns, measured on Linux localhost for SREs.
Plate 80
Plate 52
Plate 87
Hands-on mmap vs read vs chunked sequential byte-sum scan lab: real MB/s on a generated fixture (not page-touch), measured on Linux localhost for SREs.
Plate 99
Hands-on ProcessPoolExecutor vs sequential CPU lab: real wall time and worker sweep on pure-Python sum-of-squares, measured on Linux localhost for SREs.
Plate 06
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
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
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
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
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
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
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
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
Plate 08
Plate 29
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
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
Plate 12
Plate 15
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
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
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 51
Hands-on frozenset vs set vs list membership lab: real ops/s for build-once lookup-heavy paths and dict keys, benchmarked on Linux localhost for SREs.
Plate 10
Plate 77
Plate 82
Hands-on operator.itemgetter vs lambda sort-key lab: real ops/s for extract and list.sort on tuples, dicts, and objects, measured on Linux localhost (lab).
Plate 32
Hands-on ThreadPoolExecutor vs sequential lab: real wall-time speedup for I/O sleep workloads plus GIL CPU contrast, measured on Linux localhost (lab).
Plate 35
A hands-on Linux localhost lab measuring Python clock-call overhead, observed resolution, and safe choices for elapsed-time measurements.
Plate 32
A hands-on Linux localhost lab comparing memory density and numeric throughput for list[int], array.array('i'), bytearray, and memoryview.
Plate 51
Hands-on itertools vs pure Python loops lab: chain, islice, and accumulate vs equivalent for-loops with real ops/s, measured on Linux localhost (lab).
Plate 92
Hands-on collections.deque vs list queue lab: real FIFO ops/s for append/popleft vs list.pop(0) at several prefill sizes on Linux localhost (eng lab).
Plate 16
Benchmarking fixed-record packing with struct.pack, Struct.pack_into, int.to_bytes, and memoryview on Linux localhost.
Plate 98
Real Linux localhost timings for functools.lru_cache hits, miss-and-insert calls, maxsize choices, and an uncached baseline.
Plate 66
Hands-on logging vs print throughput lab: real lines/s for StreamHandler, StringIO, and a disabled logger, measured on Linux localhost only (eng lab).
Plate 38
Hands-on copy.copy vs deepcopy vs manual shallow lab: real ops/s on nested dicts and lists of several sizes, measured on Linux localhost only (eng lab).
Plate 22
A hands-on localhost lab comparing +=, list+join, preallocated join, and StringIO for building strings at real sizes.
Plate 09
A hands-on localhost lab measuring set, frozenset, list, and dict-key membership across N, with the real crossover point.
Plate 53
A hands-on Linux localhost benchmark of pathlib and os.path for joins, filesystem checks, stats, and recursive scans.
Plate 51
A hands-on Linux localhost benchmark comparing batch sorting, bisect.insort, and heapq as ordered data arrives.
Plate 92
Hands-on tempfile modes lab: TemporaryFile vs NamedTemporaryFile delete True/False vs mkstemp unlink patterns with real measured ops/s on localhost box.
Plate 80
Hands-on Python dataclass vs slots vs dict lab: instantiation and attribute ops/s plus RSS for classic, slots, dataclass, namedtuple, dict on localhost.
Plate 41
Hands-on getaddrinfo cost lab: localhost vs numeric IP vs AI_NUMERICHOST, plus hosts/stub names with real p50/p95 µs. DNS sinkhole labeled honestly here.
Plate 17
Hands-on atomic rename vs overwrite lab: tempfile+os.replace vs truncate-write with/without fsync. Real ops/s on localhost; crash-safety limits labeled.
Plate 40
Hands-on uuid.uuid4 vs secrets.token_hex/urlsafe vs os.urandom ops/s on localhost. Throughput only; uniqueness and collisions not measured in this lab.
Plate 29
Hands-on base64 vs hex encode/decode lab on 32MiB buffers with real MB/s measurements in both directions on localhost.
Plate 58
Hands-on Python re vs str methods lab on a 32MiB localhost corpus: count, find, line prefix, case-insensitive, and email scans with real measured MB/s.
Plate 71
Hands-on posix_fadvise SEQUENTIAL vs RANDOM vs NORMAL lab on localhost: cold and warm 256MiB reads after drop_caches with real measured p50 MB/s and RPS.
Plate 66
Hands-on fork COW vs multiprocessing spawn lab: PSS/Private_Dirty after fork and page dirtying, plus spawn start latency. Real numbers on the lab box.
Plate 56
Hands-on Python json vs orjson vs msgpack lab: encode/decode MB/s on records, nested, and unicode payloads. Real p50 numbers measured on localhost box.
Plate 33
Hands-on SHA-256 vs BLAKE2b vs xxHash hash throughput on 64MiB buffers (SHA-1/SHA3 labeled). Real MB/s with OpenSSL and xxHash versions on the lab box.
Plate 32
Hands-on SQLite WAL vs DELETE vs OFF journal_mode lab: insert/update RPS (FULL/NORMAL sync), plus WAL checkpoint cost. Real p50 numbers on localhost box.
Plate 71
Hands-on zstd vs gzip vs lz4 on 64MiB payloads (real /usr text, mixed, urandom). Measured compress/decompress MB/s and ratio at default levels. No Docker.
Plate 60
Hands-on fsync vs fdatasync vs none: per-write and every-N sync on 256B and 4KiB records. Real p50/p95 show about 100-200x durability tax on localhost
Plate 38
Hands-on nice/ionice lab: victim nice19 under 6 hogs ~5.7× slower (p95 ~7.4s); ionice idle O_DIRECT read ~6.1× under writers. Real numbers, no Docker.
Plate 42
Hands-on TCP_QUICKACK lab: default QA=1 on loopback; WWR set-once ~18 µs; reassert QA=1 under Nagle p95 ~48 ms, OutSegs ~13×. Real numbers, no Docker.
Plate 57
Hands-on ctx-switch lab: process pipe RTT p50 3.2 us (~0.50M sw/s); thread pipe 2.85 us; Event 9.3 us; 6 hogs blow p95 to 19 us. Real numbers, no Docker.
Plate 80
Hands-on asyncio vs ThreadPool lab: sleep 58.7× vs 44×; delayed TCP 13.8× vs serial; fast-echo trap loses; CPU flat. Real localhost numbers, no Docker.
Plate 99
Hands-on flock lab: uncontended LOCK_EX p50 0.33 us; waiter ~50 ms hold; w8 p50 ~36 ms; LOCK_NB 99% fail; LOCK_SH ~6.7x wall. Real numbers, no Docker.
Plate 30
Hands-on stdout buffering lab: full buffering maximizes throughput, while line and unbuffered modes restore live visibility on pipes.
Plate 25
Hands-on ProcessPool vs ThreadPool lab: pure-Python threads lose to processes, hashlib threads help, and sleep I/O favors threads.
Plate 89
Hands-on epoll vs select toy: ready-wait flat ~3.5 µs (8→900 FDs); select scales 4.6→16.9 µs then hits fd≥1024 cliff. Python numbers, no Docker.
Plate 87
Hands-on sendfile vs read+sendall lab: 256 MiB p50 4.41 vs 2.34 GB/s (~1.9×); copy collapses at 4 KiB. Warm localhost TCP measured, no Docker.
Plate 86
Hands-on mmap vs buffered read lab: 256 MiB p50 11.5 vs 5.4 GB/s; O_DIRECT ~0.9 GB/s warm-cache bypass. Fake endpoint-only GB/s disclosed. No Docker.
Plate 22
Hands-on nginx gzip on/off lab: HTML ~107x smaller at level 1; JSON RPS ~1987 off vs ~1031 l1 vs ~563 l6 on localhost. Measured numbers, no Docker.
Plate 60
Hands-on pipe vs tmpfile IPC lab: 5.32 vs 1.51 GB/s bulk (fsync 0.57); 64 B RTT p50 3.3 us vs 70 us vs 289 us. Localhost measured, no Docker.
Plate 51
Hands-on TCP_NODELAY vs Nagle: 1-byte reuse 124k vs 73k RPS; 32×16B writes favor Nagle (~1.7× fewer OutSegs). Delayed-ACK mean trap on localhost.