Cache Miss Latencies: L1 vs. L2 vs. L3 vs. RAM
Accessing L1 cache typically takes 1-4 CPU cycles, L2 cache 7-14 cycles, and L3 cache 20-40 cycles; however, a miss to all cache levels requiring main memory access can cost 100-300+ CPU cycles.
The top 3
- Cache Hierarchy Latencies: L1 to RAM in Nanoseconds: Accessing data from L1 cache can take as little as 0.3-1.2 nanoseconds, while L2 cache typically responds in 2-5 ns, L3 cache in 10-20 ns, and main RAM can take 50-100 nanoseconds or more.
- RAM Access: Up to 200x Slower Than L1 Cache: A cache miss that forces the CPU to retrieve data from main RAM can be 40-60 times slower in nanoseconds than an L1 cache hit, and in terms of CPU cycles, it can be over 100 to even 200 times slower.
- CPU Cycles: L1's 1-4 Cycle Advantage Over RAM's 60-200+: While L1 cache hits typically complete in a mere 1-4 CPU cycles, L2 cache hits take around 4-10 cycles, L3 hits 20-40 cycles, and accessing main RAM can incur a penalty of 60-200 or more CPU cycles.
Sources
Open the full topic