Memory Hierarchy: Astonishing Latency Gaps, From Nanoseconds to Milliseconds

Accessing CPU's L1 cache takes approximately 1 nanosecond, while main memory (DRAM) can take 50-100 nanoseconds. The gap widens significantly for storage: NVMe SSDs are around 50-100 microseconds, and traditional HDDs can be 5-15 milliseconds, spanning seven orders of magnitude in latency.

The top 3

  1. L1 Cache vs. Main Memory: The 100x Latency Chasm: Accessing data from the L1 cache takes approximately 1 nanosecond, while fetching it from main memory (DRAM) can be 50-100 times slower, ranging from 50 to 100 nanoseconds. This stark difference is a primary reason for optimizing data locality.
  2. Cache Miss Penalty: Hundreds of CPU Cycles Lost: A single L1 cache miss can cause the CPU to stall for 40 to 300 cycles while waiting for data from slower memory levels (L2, L3, or main memory). This massive performance penalty, known as the 'memory wall,' severely limits CPU utilization.
  3. Registers vs. SSD: Millions of Times Slower Data Access: Accessing data directly from CPU registers takes a single nanosecond, whereas retrieving it from a solid-state drive (SSD) can take tens of microseconds, a colossal difference of tens of thousands to millions of times in access speed.

Sources

Open the full topic