Cache Associativity
constexpr int N = 64;
for (auto j = 0u; j < 1024 / N; ++j) {
for (auto i = 0u; i < N; ++i) {
sum += arr1[i] + arr2[i];
}
}
constexpr int N = 128;
for (auto j = 0u; j < 1024 / N; ++j) {
for (auto i = 0u; i < N; ++i) {
sum += arr1[i] + arr2[i];
}
}
* The benchmark is run under Apple Macbook Air M2.
* For the full benchmark code, please refer here.