How long does it take to compare StringBox objects
| 49 | |
| 50 | // How long does it take to compare StringBox objects |
| 51 | static void InternedStringComparison(benchmark::State& state) { |
| 52 | auto strings = makeRandomStrings(state.range(0)); |
| 53 | auto& stringCache = StringCache::getGlobal(); |
| 54 | |
| 55 | auto cachedStrings = internStrings(stringCache, strings); |
| 56 | |
| 57 | for (auto _ : state) { |
| 58 | for (const auto& str : cachedStrings) { |
| 59 | for (const auto& other : cachedStrings) { |
| 60 | benchmark::DoNotOptimize(str == other); |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | BENCHMARK(InternedStringComparison)->Range(8, 512); |
| 66 | |
| 67 | static void CreateMapWithRegularStrings(benchmark::State& state) { |
nothing calls this directly
no test coverage detected