#cache
3 articles
01
·Data Structures·★ MEMBER·11 min read
Cache-Friendly Code — Why Two O(n) Loops Can Differ by 10×
Two implementations with identical complexity can differ by an order of magnitude, because the CPU never fetches one value — it fetches a 64-byte block. Locality, cache lines, arrays versus linked lists, AoS versus SoA, loop order and false sharing, from zero assumed background to checking it yourself with perf.
02
·Complexity·★ MEMBER·8 min read
When Big-O and Your Benchmarks Disagree — Caches, Branches, and Memory Bandwidth
Two O(n) programs can differ by orders of magnitude in the real world. This article unpacks what Big-O deliberately throws away — cache hierarchies, branch prediction, and memory bandwidth — and how to reason about each.
03
·Computer Architecture·★ MEMBER·9 min read
The Memory Wall from Scratch — Why Moving Data Costs More Than Computing
Multiplying two numbers is cheap; delivering them is not. Starting from the physics of charging a wire, we get to why DRAM latency never shrank, the orders of magnitude in the memory hierarchy, Little's law, machine balance and the roofline — and end with a procedure for deciding whether your kernel is compute bound or bandwidth bound.