#include const size_t N = 5'000; int matriz[N][N]; void f1(benchmark::State& state) { for (auto _ : state) { for (size_t i = 0; i < N; ++i) for (size_t j = 0; j < N; ++j) matriz[i][j] = 0; } } void f2(benchmark::State& state) { for (auto _ : state) { for (size_t i = 0; i < N; ++i) for (size_t j = 0; j < N; ++j) matriz[j][i] = 0; } } BENCHMARK(f1); BENCHMARK(f2); BENCHMARK_MAIN();