| 35 | BENCHMARK(CreateFlatMap)->DenseRange(8, 128, 8); |
| 36 | |
| 37 | static void CreateUnorderedMapWithReserve(benchmark::State& state) { |
| 38 | StringCache stringCache; |
| 39 | auto cachedStrings = makeRandomInternedStrings(stringCache, state.range(0), 10); |
| 40 | |
| 41 | for (auto _ : state) { |
| 42 | std::unordered_map<StringBox, bool> map; |
| 43 | map.reserve(cachedStrings.size()); |
| 44 | |
| 45 | for (const auto& str : cachedStrings) { |
| 46 | map[str] = true; |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | BENCHMARK(CreateUnorderedMapWithReserve)->DenseRange(8, 128, 8); |
| 51 | |
| 52 | static void CreateFlatMapWithReserve(benchmark::State& state) { |
nothing calls this directly
no test coverage detected