Why does cache locality matter for array performance?
问题 In the following blog there is a statement about the advantage of arrays over linked lists: Arrays have better cache locality that can make a pretty big difference in performance. What does that mean? I don't understand how cache locality can provide a huge performance benefit. 回答1: See my answer about spatial and temporal locality. In particular, arrays are contiguous memory blocks, so large chunks of them will be loaded into the cache upon first access. This makes it comparatively quick to