diff --git a/configure.py b/configure.py index 36f05efb2c..36d9a2ebdb 100755 --- a/configure.py +++ b/configure.py @@ -158,6 +158,7 @@ urchin_tests = [ 'tests/urchin/types_test', 'tests/urchin/keys_test', 'tests/perf/perf_mutation', + 'tests/perf/perf_hash', 'tests/perf/perf_cql_parser', 'tests/perf/perf_simple_query', 'tests/urchin/cql_query_test', diff --git a/tests/perf/perf_hash.cc b/tests/perf/perf_hash.cc new file mode 100644 index 0000000000..44faeed440 --- /dev/null +++ b/tests/perf/perf_hash.cc @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Cloudius Systems + */ + +#include "utils/murmur_hash.hh" +#include "tests/perf/perf.hh" + +volatile uint64_t black_hole; + +int main(int argc, char* argv[]) { + const uint64_t seed = 0; + auto src = bytes("0123412308129301923019283056789012345"); + + uint64_t sink = 0; + + std::cout << "Timing fixed hash...\n"; + + time_it([&] { + std::array dst; + utils::murmur_hash::hash3_x64_128(src, seed, dst); + sink += dst[0]; + sink += dst[1]; + }); + + std::cout << "Timing iterator hash...\n"; + + time_it([&] { + std::array dst; + utils::murmur_hash::hash3_x64_128(src.begin(), src.size(), seed, dst); + sink += dst[0]; + sink += dst[1]; + }); + + black_hole = sink; +}