MCPcopy Create free account
hub / github.com/Snapchat/Valdi / IterateFlatMap

Function IterateFlatMap

valdi/test/benchmark/map_benchmark.cpp:125–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123BENCHMARK(IterateUnorderedMap)->DenseRange(8, 128, 8);
124
125static void IterateFlatMap(benchmark::State& state) {
126 StringCache stringCache;
127 auto cachedStrings = makeRandomInternedStrings(stringCache, state.range(0), 10);
128
129 Valdi::FlatMap<StringBox, bool> map;
130
131 for (const auto& str : cachedStrings) {
132 map[str] = true;
133 }
134
135 for (auto _ : state) {
136 for ([[maybe_unused]] const auto& it : map) {
137 benchmark::DoNotOptimize(it);
138 }
139 }
140}
141BENCHMARK(IterateFlatMap)->DenseRange(8, 128, 8);
142
143BENCHMARK_MAIN();

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected