| 56 | |
| 57 | template <HashType hashType> |
| 58 | static void bench_hash(benchmark::State& state) { |
| 59 | auto length = 1 << state.range(0); |
| 60 | auto key = getKey(length); |
| 61 | while (state.KeepRunning()) { |
| 62 | hash<hashType>(key, length); |
| 63 | } |
| 64 | state.SetItemsProcessed(static_cast<long>(state.iterations())); |
| 65 | } |
| 66 | |
| 67 | BENCHMARK_TEMPLATE(bench_hash, HashType::CRC32C)->DenseRange(2, 18)->ReportAggregatesOnly(true); |
| 68 | BENCHMARK_TEMPLATE(bench_hash, HashType::HashLittle2)->DenseRange(2, 18)->ReportAggregatesOnly(true); |