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

Function CreateMapWithRegularStrings

valdi/test/benchmark/string_benchmark.cpp:67–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65BENCHMARK(InternedStringComparison)->Range(8, 512);
66
67static void CreateMapWithRegularStrings(benchmark::State& state) {
68 auto strings = makeRandomStrings(state.range(0));
69 for (auto _ : state) {
70 FlatMap<std::string, bool> map;
71 map.reserve(strings.size());
72
73 for (const auto& str : strings) {
74 map[str] = true;
75 }
76 }
77}
78BENCHMARK(CreateMapWithRegularStrings)->Range(8, 512);
79
80static void CreateMapWithInternedStrings(benchmark::State& state) {

Callers

nothing calls this directly

Calls 3

makeRandomStringsFunction · 0.85
reserveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected