https://en.algorithmica.org/hpc/cpu-cache/associativity/
The section does not specify that this slowdown only occurs when iterating the array multiple times, leading to confusion, and perhaps believing that a single iteration of an array also suffers of some unspecific cache thrashing slowdown? In my cpu it seems to only exhibit a difference between the two loops when I do a few full iterations of each, not if I allocate a fresh array for each loop.
I suggest changing the loops to the following, in order to prevent confusion.
for (intj=0; j<K; j++) for (inti=0; i<N; i+= {256,257})
a[i]++;Thank you for the truly great resource that is this book!
https://en.algorithmica.org/hpc/cpu-cache/associativity/
The section does not specify that this slowdown only occurs when iterating the array multiple times, leading to confusion, and perhaps believing that a single iteration of an array also suffers of some unspecific cache thrashing slowdown? In my cpu it seems to only exhibit a difference between the two loops when I do a few full iterations of each, not if I allocate a fresh array for each loop.
I suggest changing the loops to the following, in order to prevent confusion.
Thank you for the truly great resource that is this book!