Cache Locality
noun
say it: “KASH loh-KAL-ih-tee” /kæʃ loʊˈkælɪti/
Keeping data used together close together in memory, so the processor fetches it in fewer trips.
What is cache locality?
Cache locality means keeping data that's used together close together in memory. The processor fetches memory in chunks and keeps recent chunks in a small, fast cache, so items side by side come along together, like grabbing a whole shelf of books in one trip. It's why walking an array is usually faster than walking a linked list, even though both are O(n).
In a sentence
- “Looping over an array is fast partly because of cache locality: neighbors are fetched together.”
Level: Journeyman · More Software Development terms at this level
Updated