| 113 | BENCHMARK(QueryMapWithRegularStrings)->Range(8, 512); |
| 114 | |
| 115 | static void QueryMapWithInternedStrings(benchmark::State& state) { |
| 116 | auto strings = makeRandomStrings(state.range(0)); |
| 117 | auto& stringCache = StringCache::getGlobal(); |
| 118 | |
| 119 | auto cachedStrings = internStrings(stringCache, strings); |
| 120 | FlatMap<StringBox, bool> map; |
| 121 | |
| 122 | for (const auto& str : cachedStrings) { |
| 123 | map[str] = true; |
| 124 | } |
| 125 | |
| 126 | for (auto _ : state) { |
| 127 | for (const auto& str : cachedStrings) { |
| 128 | const auto& it = map.find(str); |
| 129 | |
| 130 | benchmark::DoNotOptimize(it != map.end()); |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | BENCHMARK(QueryMapWithInternedStrings)->Range(8, 512); |
| 135 | |
| 136 | BENCHMARK_MAIN(); |
nothing calls this directly
no test coverage detected