1 #include "llvm/Support/xxhash.h"
2 #include "benchmark/benchmark.h"
6 static uint32_t xorshift(uint32_t State
) {
13 static void BM_xxh3_64bits(benchmark::State
&State
) {
14 std::unique_ptr
<uint32_t[]> Data(new uint32_t[State
.range(0) / 4]);
16 uint32_t Prev
= 0xcafebabe;
17 for (int64_t I
= 0; I
< State
.range(0) / 4; I
++)
18 Data
[I
] = Prev
= xorshift(Prev
);
20 llvm::ArrayRef DataRef
=
21 llvm::ArrayRef(reinterpret_cast<uint8_t *>(Data
.get()), State
.range(0));
24 llvm::xxh3_64bits(DataRef
);
27 BENCHMARK(BM_xxh3_64bits
)->Arg(32)->Arg(512)->Arg(64 * 1024)->Arg(1024 * 1024);