MCPcopy Create free account
hub / github.com/apple/foundationdb / bench_populate

Function bench_populate

flowbench/BenchPopulate.cpp:34–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32// Benchmarks the population of a VectorRef<MutationRef>
33template <bool emplace>
34static 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
53BENCHMARK_TEMPLATE(bench_populate, EMPLACE_BACK)->Ranges({ { 1, 1 << 20 }, { 1, 512 } })->ReportAggregatesOnly(true);
54BENCHMARK_TEMPLATE(bench_populate, PUSH_BACK)->Ranges({ { 1, 1 << 20 }, { 1, 512 } })->ReportAggregatesOnly(true);

Callers

nothing calls this directly

Calls 5

getKVFunction · 0.85
MutationRefClass · 0.85
rangeMethod · 0.45
reserveMethod · 0.45
push_back_deepMethod · 0.45

Tested by

no test coverage detected