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

Function QueryFlatMap

valdi/test/benchmark/map_benchmark.cpp:87–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85BENCHMARK(QueryUnorderedMap)->DenseRange(8, 128, 8);
86
87static void QueryFlatMap(benchmark::State& state) {
88 StringCache stringCache;
89 auto cachedStrings = makeRandomInternedStrings(stringCache, state.range(0), 10);
90
91 Valdi::FlatMap<StringBox, bool> map;
92
93 for (const auto& str : cachedStrings) {
94 map[str] = true;
95 }
96
97 for (auto _ : state) {
98 for (const auto& str : cachedStrings) {
99 const auto& it = map.find(str);
100
101 benchmark::DoNotOptimize(it != map.end());
102 }
103 }
104}
105BENCHMARK(QueryFlatMap)->DenseRange(8, 128, 8);
106
107static void IterateUnorderedMap(benchmark::State& state) {

Callers

nothing calls this directly

Calls 3

endMethod · 0.65
findMethod · 0.45

Tested by

no test coverage detected