#include #include #include #include const size_t N = 1 << 25; // 32M int v[N]; // 32M * 4B = 128MB void f1(int i) { std::ranges::fill(v, i); } void f2(int i) { std::fill(std::rbegin(v), std::rend(v), i); } template static void test(benchmark::State &state) { int i = 0; for (auto _ : state) f1(i++); } BENCHMARK(test)->Iterations(100); BENCHMARK(test)->Iterations(100); BENCHMARK_MAIN();