| 32 | // Benchmarks the population of a VectorRef<MutationRef> |
| 33 | template <bool emplace> |
| 34 | static void bench_populate(benchmark::State& state) { |
| 35 | size_t items = state.range(0); |
| 36 | size_t size = state.range(1); |
| 37 | auto kv = getKV(size, size); |
| 38 | while (state.KeepRunning()) { |
| 39 | Standalone<VectorRef<MutationRef>> mutations; |
| 40 | mutations.reserve(mutations.arena(), items); |
| 41 | for (int i = 0; i < items; ++i) { |
| 42 | if constexpr (emplace) { |
| 43 | mutations.emplace_back_deep(mutations.arena(), MutationRef::Type::SetValue, kv.key, kv.value); |
| 44 | } else { |
| 45 | mutations.push_back_deep(mutations.arena(), MutationRef(MutationRef::Type::SetValue, kv.key, kv.value)); |
| 46 | } |
| 47 | } |
| 48 | benchmark::DoNotOptimize(mutations); |
| 49 | } |
| 50 | state.SetItemsProcessed(items * static_cast<long>(state.iterations())); |
| 51 | } |
| 52 | |
| 53 | BENCHMARK_TEMPLATE(bench_populate, EMPLACE_BACK)->Ranges({ { 1, 1 << 20 }, { 1, 512 } })->ReportAggregatesOnly(true); |
| 54 | BENCHMARK_TEMPLATE(bench_populate, PUSH_BACK)->Ranges({ { 1, 1 << 20 }, { 1, 512 } })->ReportAggregatesOnly(true); |
nothing calls this directly
no test coverage detected