Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

spatial locality

The habit programs have of using data next to what they just used, like the next array element; a cache brings in a whole line so the neighbours are already there.

A reference stream has spatial locality when addresses near a recently accessed address are likely to be accessed soon; caches exploit it by transferring whole lines, and hardware prefetchers by fetching ahead.

Examples

  • Reading a[0], a[1], a[2] in order uses each 64-byte line for 16 consecutive 4-byte ints.

Read the full section →