From 912798e5cb70d72322386aeec87b1b0af81d174e Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 22 Jul 2022 18:22:34 +0300 Subject: [PATCH] Change uint64.cpp to use byteswapped indices instead of shifted indices --- benchmark/uint64.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/benchmark/uint64.cpp b/benchmark/uint64.cpp index f4624f7b..4cd1b033 100644 --- a/benchmark/uint64.cpp +++ b/benchmark/uint64.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #ifdef HAVE_ABSEIL @@ -65,7 +66,7 @@ static void init_indices() for( unsigned i = 1; i <= N*2; ++i ) { - indices3.push_back( (std::uint64_t)i << 40 ); + indices3.push_back( boost::endian::endian_reverse( static_cast( i ) ) ); } } @@ -90,7 +91,7 @@ template BOOST_NOINLINE void test_insert( Map& map, std::chrono::stea map.insert( { indices3[ i ], i } ); } - print_time( t1, "Consecutive shifted insert", 0, map.size() ); + print_time( t1, "Consecutive reversed insert", 0, map.size() ); std::cout << std::endl; } @@ -136,7 +137,7 @@ template BOOST_NOINLINE void test_lookup( Map& map, std::chrono::stea } } - print_time( t1, "Consecutive shifted lookup", s, map.size() ); + print_time( t1, "Consecutive reversed lookup", s, map.size() ); std::cout << std::endl; } @@ -187,7 +188,7 @@ template BOOST_NOINLINE void test_erase( Map& map, std::chrono::stead map.erase( indices3[ i ] ); } - print_time( t1, "Consecutive shifted erase", 0, map.size() ); + print_time( t1, "Consecutive reversed erase", 0, map.size() ); std::cout << std::endl; }