#include const int N = 1 << 25; int f1() { int r = 0; for (int i = 0; i < N; ++i) r += i; return r; } int f2() { int r = 0; for (int i = 0; i < 2 * N; ++i) r += i; return r; } template static void test(benchmark::State &state) { int x = 0; for (auto _ : state) benchmark::DoNotOptimize(x += f()); state.SetItemsProcessed(state.iterations()); } BENCHMARK(test); BENCHMARK(test); BENCHMARK_MAIN();