diff --git a/benchmark/unordered.cpp b/benchmark/unordered.cpp index 5a92b9b..1e3e342 100644 --- a/benchmark/unordered.cpp +++ b/benchmark/unordered.cpp @@ -3,6 +3,7 @@ // https://www.boost.org/LICENSE_1_0.txt #define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX20_CISO646_REMOVED_WARNING #include #include @@ -12,6 +13,9 @@ #ifdef HAVE_ABSEIL # include "absl/hash/hash.h" #endif +#ifdef HAVE_MULXP_HASH +# include "mulxp_hash.hpp" +#endif #include #include #include @@ -188,6 +192,44 @@ public: } }; +// mulxp_hash + +#ifdef HAVE_MULXP_HASH + +struct mulxp0_hash_ +{ + std::size_t operator()( std::string const& st ) const BOOST_NOEXCEPT + { + return mulxp0_hash( (unsigned char const*)st.data(), st.size(), 0 ); + } +}; + +struct mulxp1_hash_ +{ + std::size_t operator()( std::string const& st ) const BOOST_NOEXCEPT + { + return mulxp1_hash( (unsigned char const*)st.data(), st.size(), 0 ); + } +}; + +struct mulxp2_hash_ +{ + std::size_t operator()( std::string const& st ) const BOOST_NOEXCEPT + { + return mulxp2_hash( (unsigned char const*)st.data(), st.size(), 0 ); + } +}; + +struct mulxp3_hash_ +{ + std::size_t operator()( std::string const& st ) const BOOST_NOEXCEPT + { + return mulxp3_hash( (unsigned char const*)st.data(), st.size(), 0 ); + } +}; + +#endif + // test_hash_speed template void test_hash_speed( int N, V const& v ) @@ -351,6 +393,12 @@ int main() #ifdef HAVE_ABSEIL test_hash_speed >( N * 16, v ); #endif +#ifdef HAVE_MULXP_HASH + test_hash_speed( N * 16, v ); + test_hash_speed( N * 16, v ); + test_hash_speed( N * 16, v ); + test_hash_speed( N * 16, v ); +#endif std::puts( "" ); @@ -378,6 +426,12 @@ int main() test_hash_collision >( N * 16, v, n ); #ifdef HAVE_ABSEIL test_hash_collision >( N * 16, v, n ); +#endif +#ifdef HAVE_MULXP_HASH + test_hash_collision( N * 16, v, n ); + test_hash_collision( N * 16, v, n ); + test_hash_collision( N * 16, v, n ); + test_hash_collision( N * 16, v, n ); #endif } @@ -396,6 +450,12 @@ int main() #ifdef HAVE_ABSEIL test_container_speed >( N, v ); #endif +#ifdef HAVE_MULXP_HASH + test_container_speed( N, v ); + test_container_speed( N, v ); + test_container_speed( N, v ); + test_container_speed( N, v ); +#endif std::puts( "" ); }