Memory - Memory Latency
Memory - Memory Latency
π§ Memory Latency Hierarchy β Why Caches Matter
This table compares hardware access latency with a scaled real-world time analogy
to illustrate how dramatically access time increases across memory/storage layers.
1οΈβ£ Memory Access Latency Comparison
| System Event | Actual Latency | Scaled Human-Time Analogy |
|---|---|---|
| CPU Register / 1 CPU cycle | ~0.4 ns | 1 second |
| L1 Cache Access | ~0.9 ns | 2 seconds |
| L2 Cache Access | ~2.8 ns | 7 seconds |
| L3 Cache Access | ~28 ns | 1 minute |
| Main Memory (RAM) | ~100 ns | 4 minutes |
| Optane / Persistent Memory | ~10 Β΅s | 7 hours |
| NVMe SSD I/O | ~25 Β΅s | 17 hours |
| SSD I/O | ~50β150 Β΅s | 1.5β4 days |
| HDD (Rotational Disk) | ~1β10 ms | 1β9 months |
| Internet (SF β NYC) | ~65 ms | 5 years |
| Internet (SF β Hong Kong) | ~141 ms | 11 years |
2οΈβ£ Key Insight β Latency Grows Explosively
Each step down the hierarchy is orders of magnitude slower:
- Register β Cache: ~2Γ slower
- Cache β RAM: ~100Γ slower
- RAM β SSD: ~1,000Γ slower
- SSD β HDD: ~10,000Γ slower
- Disk β Internet: Millions of times slower
This is why memory locality and caching dominate real-world performance.
3οΈβ£ Why Data Is Accessed in This Order
(L1 β L2 β L3 β RAM β Storage)
β Reason 1 β Speed vs Cost Tradeoff
| Layer | Speed | Cost | Capacity |
|---|---|---|---|
| Registers | Fastest | Very expensive | Tiny |
| L1 Cache | Very fast | Expensive | Small |
| L2 Cache | Fast | Expensive | Medium |
| L3 Cache | Slower | Cheaper | Larger |
| RAM | Much slower | Affordable | Large |
| Storage | Slowest | Cheapest | Huge |
We cannot build large memory entirely from ultra-fast storage β too expensive and power-hungry.
β Reason 2 β Locality of Reference
Programs tend to:
- Reuse recent data (temporal locality)
- Access nearby memory (spatial locality)
So CPU checks fast memory first, because it is likely already there.
β Reason 3 β Avoiding Massive Stall Time
If CPU accessed RAM every time:
- Pipeline stalls
- CPU idle time skyrockets
- Performance collapses
Caches hide RAM latency so the CPU stays busy.
β Reason 4 β Hierarchical Filtering Model
Think of memory like a search chain:
This post is licensed under CC BY 4.0 by the author.

