A set-associative cache partitions cache lines into sets. Each memory block maps to one set, then occupies one of that set’s available lines. This avoids searching every cache line, as a fully associative cache might, while allowing more placement flexibility than a single fixed line. section 12.1.5
A useful diagnostic mistake is treating nearby memory accesses as equally cache-friendly. In a reduced example, a 512-byte cache has eight 64-byte lines and uses two-way associativity, so each set contains two lines. Address bits determine the destination set; competing blocks can replace one another when they map to the same set. section 12.1.5
Matrix traversal
The same loop sums the first eight elements of rows stored in [][512]int64 and [][513]int64. The resulting performance difference is attributed to CPU-cache placement, making the array shape a useful diagnostic comparison. section 12.1.5
