Cache Miss Penalty: Up to 100x Slower Without Spatial Locality
The performance difference between accessing data from cache (a 'hit') and fetching it from main memory (a 'miss') can be 10-100 times, with main memory access taking 60-100 nanoseconds compared to less than a nanosecond for CPU instructions. Optimizing spatial locality drastically reduces these costly cache misses.
The top 3
- Max Cache Miss Penalty: Top 3 Driving Factors: The maximum cache miss penalty, potentially hundreds of CPU cycles, is primarily driven by deep memory hierarchies (e.g., L3 to DRAM causing 100x slowdowns), high main memory (DRAM) access latency, and contention on shared memory buses during data transfer.
- Worst Spatial Locality: Top 3 Code Patterns: Code patterns notorious for destroying spatial locality include random memory access (e.g., poorly distributed hash table lookups), traversing linked lists with scattered nodes, and accessing column-major elements in row-major ordered 2D arrays, leading to significantly higher cache miss rates.
- Cache Miss Cost: Top 3 Latency Components: The significant latency of a cache miss, often measured in hundreds of CPU cycles, is primarily composed of memory bus arbitration, the actual DRAM access time to retrieve data, and the subsequent data transfer time back to the cache line.
Sources
Open the full topic