TLB Shoot Down

for (int i = 0; i < 10'000'000; ++i) {
  sum += a[i % 1'000'000];
}
^ This is Faster?
# Thread 1
for (int i = 0; i < 1'000'000; ++i) {
  sum += a[i % 1'000'000];
}

# Thread 2
while (++cnt) {
  if (cnt % 2 == 0)
    x = new int[10000];
  else
    delete [] x;
}
^ This is Faster?

* The benchmark is run under AMD Ryzen 9.

* For the full benchmark code, please refer here.

* For illustration purposes only, see FAQ for more details.