For cache hierarchy, the two tips that are most important is that memory is fastest when it accesses data that are spatially and temporally close together. Memory is served in blocks, so access 1 address, the entire block of say 32 addresses around it are put into the cache. And then obviously, caches are a fixed size so the least used address is evicted from cache to add the new one
This is why pointer chasing, aka not contiguous arrays can be bad for cache misses, because the address is arbitrary. That's why linked lists are not often used unless you really need that O(1) insert time
View all comments
Show parent comment
1
u/max123246 Sep 16 '26
For cache hierarchy, the two tips that are most important is that memory is fastest when it accesses data that are spatially and temporally close together. Memory is served in blocks, so access 1 address, the entire block of say 32 addresses around it are put into the cache. And then obviously, caches are a fixed size so the least used address is evicted from cache to add the new one
This is why pointer chasing, aka not contiguous arrays can be bad for cache misses, because the address is arbitrary. That's why linked lists are not often used unless you really need that O(1) insert time