Mechanical sympathy
The hardware under your abstractions: CPU caches, branch prediction, virtual memory, thread scaling, and why async is not parallelism.
Read in order: later instalments assume the earlier ones. 7 more instalments in the publish queue.
- 01 CPU Caches and Spatial Locality: Why an Array is 3x Faster Than a Linked List for the Exact Same Big-O Complexity
Why arrays are faster than linked lists on real CPUs: cache lines, spatial locality, hardware prefetchers, and pointer chasing.
- 02 Branch Prediction: Why an if Inside a Hot Loop Costs Milliseconds
How CPU pipelining and branch predictors work, why mispredictions flush the pipeline, and how sorting, branchless code, and loop unrolling help.
- 03 Virtual Memory and Lazy Allocation: Why RSS Matters More Than malloc()
How virtual memory promises work, why malloc() doesn't equal RAM, what page faults do, how lazy allocation overbooks memory, and why OOM kills by RSS.
- 04 Thread-per-Core Architecture: Why Extra Threads Eventually Destroy Throughput
Oversized thread pools stall: timeslicing, context switches, cache thrashing. Thread-per-core, CPU pinning, and async I/O match physical cores.
- 05 Bloom Filters vs Counting Bloom Filters: When Deletions Kill Performance
Why counting (deletable) Bloom filters often lose in production: cache misses, random memory access, and better alternatives like hash tables or Cuckoo filters.
- 06 Cuckoo Filters: Cache-Friendly Membership Checks With Deletions
How Cuckoo filters work: fingerprints, two-bucket lookups, kick-out insertions, why they stay cache-friendly, and the real tradeoff of insertion failure.