| 63 | } |
| 64 | |
| 65 | static void HashIntegers(benchmark::State& state) { // NOLINT non-const reference |
| 66 | const std::vector<int64_t> values = MakeIntegers<int64_t>(10000); |
| 67 | |
| 68 | while (state.KeepRunning()) { |
| 69 | hash_t total = 0; |
| 70 | for (const int64_t v : values) { |
| 71 | total += ScalarHelper<int64_t, 0>::ComputeHash(v); |
| 72 | total += ScalarHelper<int64_t, 1>::ComputeHash(v); |
| 73 | } |
| 74 | benchmark::DoNotOptimize(total); |
| 75 | } |
| 76 | state.SetBytesProcessed(2 * state.iterations() * values.size() * sizeof(int64_t)); |
| 77 | state.SetItemsProcessed(2 * state.iterations() * values.size()); |
| 78 | } |
| 79 | |
| 80 | static void BenchmarkStringHashing(benchmark::State& state, // NOLINT non-const reference |
| 81 | const std::vector<std::string>& values) { |