Temporal locality means that a recently accessed memory location is likely to be accessed again soon. It works with spatial locality as part of locality of reference and helps explain why CPU caches speed repeated accesses. section 12.1.2
Repeated loop accesses
In a slice-summing loop, the variables i, length, and total are accessed throughout the iteration, giving them temporal locality. The slice elements also benefit from spatial locality because the backing array is contiguous. section 12.1.2
Temporal locality motivates caching repeated values, while spatial locality explains why the CPU fetches a whole cache line rather than one variable. A typical 64-byte line holds eight int64 values. section 12.1.2
