CPU Cache Levels Explained: Why L1 Is Faster Than L3
CPU cache speed differences come from physical distance to the core and size tradeoffs. L1 (~1ns) is tiny but inside the core. L3 (~10-40ns) is larger but farther away. At 3 GHz, even millimeters matter.
CPU caches (L1, L2, L3) have dramatically different speeds primarily because of physical distance from the CPU core and size tradeoffs. The desk analogy: - L1 (your desk): Tiny but instant access. ~1 nanosecond. Sits directly inside the CPU core. - L2 (your backpack): Larger, slightly slower. ~3-10 ns. Near the core but not inside it. - L3 (the bookshelf across the room): Much larger, noticeably slower. ~10-40 ns. Shared between all cores. - Main RAM (the library down the street): Huge but slow. ~50-100 ns. Why distance matters at CPU speeds: At 3 GHz, one clock cycle is 0.33 nanoseconds. In that time, an electrical signal travels about 10 centimeters. Even moving a cache a few millimeters further from the core adds measurable latency at these speeds. The size-speed tradeoff: - Faster memory requires more transistors per bit (SRAM with 6 transistors per bit vs DRAM with 1) - More transistors = more heat and more chip area - So L1 is kept tiny (32-64 KB typically) to be fast, while L3 can be large (8-64 MB) because it accepts being slower Doubling the physical distance of L1 wouldn't just make it 2x slower — it could be 2-4x slower because of how signal propagation, routing complexity, and electrical interference compound at nanometer scales.