blob: 1fe2fdcc21c1faf2fe2df742b436685954bfed2f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include <contrib/libs/benchmark/include/benchmark/benchmark.h>
#include <util/digest/murmur.h>
#include <util/system/types.h>
#include <array>
constexpr auto MakeTestData() {
std::array<ui64, 4096> result;
for (ui64 i = 0; i < result.size(); ++i) {
result[i] = i;
}
return result;
}
constexpr auto TEST_DATA = MakeTestData();
template <typename Result>
static void BenchmarkMurmurHash(benchmark::State& state) {
for (auto _ : state) {
Result hash = MurmurHash<Result>(TEST_DATA.data(), sizeof(TEST_DATA));
Y_DO_NOT_OPTIMIZE_AWAY(hash);
}
}
BENCHMARK_TEMPLATE(BenchmarkMurmurHash, ui32);
BENCHMARK_TEMPLATE(BenchmarkMurmurHash, ui64);
|