4 ms·
I think there's more to cache locality than prefetching. In an array, consecutive elements will be usually be adjacent in physical memory (excepting page bounda
by Borealid 4y ago
I think there's more to cache locality than prefetching. In an array, consecutive elements will be usually be adjacent in physical memory (excepting page boundaries ), so each cache line load where a cache line is larger than the array element will "overfetch" into the next element. This should mean fewer total cache loads and thus more efficient use of memory bandwidth for situations where it is constrained (such as walking a list).
- AstralStorm 4y agoThen again, if you have control over allocations you can prefetch whole chunks of data to which the list refers making this point moot. Often lists refer to arrays or sections of memory. The performance loss if any appears in bigger structures where you do want to have explicit control anyway.