Register Spill

// arr.size == 1'000'000
constexpr int N = 4;

for (auto i = 0u; i < arr.size(); i += N) {
  for (int j = 0; j < N; ++j) {
    sum += arr[i + j] * (i + j);
  }
}
// arr.size == 1'000'000
constexpr int N = 8;

for (auto i = 0u; i < arr.size(); i += N) {
  for (int j = 0; j < N; ++j) {
    sum += arr[i + j] * (i + j);
  }
}

* The benchmark is run under Apple Macbook Air M2.

* For the full benchmark code, please refer here.