Performance
9 engineering logs on Performance. Newest first.
- Implementing LFU Cache in O(1) Time: A Hands-on Breakdown
LFU evicts the least popular key, not the oldest. The O(1) version needs two hash maps and linked lists per frequency bucket.
- AI agents break connection pooling by holding the slot while they think
Agents keep pooled DB connections open for LLM inference, exhausting pools and evicting buffer cache. Decouple reasoning from data, route agents to replicas, and never hold a connection across an inference call.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- The RUM Conjecture: You Cannot Optimize Reads, Updates, and Memory at Once
How the RUM Conjecture explains real-world database trade-offs between read latency, write throughput, and memory overhead across B-Trees, LSM-Trees, and hash indexes.