mirror of
https://github.com/boostorg/container_hash.git
synced 2025-08-01 21:44:37 +02:00
Add mulxp_hash to benchmark/unordered_flat.cpp
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
|
||||
#define _SILENCE_CXX20_CISO646_REMOVED_WARNING
|
||||
|
||||
#include <boost/unordered/unordered_flat_map.hpp>
|
||||
#include <boost/core/detail/splitmix64.hpp>
|
||||
@@ -10,6 +11,9 @@
|
||||
#ifdef HAVE_ABSEIL
|
||||
# include "absl/hash/hash.h"
|
||||
#endif
|
||||
#ifdef HAVE_MULXP_HASH
|
||||
# include "mulxp_hash.hpp"
|
||||
#endif
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <cstdint>
|
||||
@@ -400,6 +404,51 @@ struct absl_hash: absl::Hash<std::string>
|
||||
using is_avalanching = void;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// mulxp_hash
|
||||
|
||||
#ifdef HAVE_MULXP_HASH
|
||||
|
||||
struct mulxp0_hash_
|
||||
{
|
||||
using is_avalanching = void;
|
||||
|
||||
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_
|
||||
{
|
||||
using is_avalanching = void;
|
||||
|
||||
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_
|
||||
{
|
||||
using is_avalanching = void;
|
||||
|
||||
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_
|
||||
{
|
||||
using is_avalanching = void;
|
||||
|
||||
std::size_t operator()( std::string const& st ) const BOOST_NOEXCEPT
|
||||
{
|
||||
return mulxp3_hash( (unsigned char const*)st.data(), st.size(), 0 );
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -415,8 +464,20 @@ int main()
|
||||
test< mul31_unrolled_hash >( "mul31_unrolled_hash" );
|
||||
test< fnv1a_hash >( "fnv1a_hash" );
|
||||
test< old_boost_hash >( "old_boost_hash" );
|
||||
|
||||
#ifdef HAVE_ABSEIL
|
||||
|
||||
test< absl_hash >( "absl::Hash" );
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MULXP_HASH
|
||||
|
||||
test< mulxp0_hash_ >( "mulxp0_hash" );
|
||||
test< mulxp1_hash_ >( "mulxp1_hash" );
|
||||
test< mulxp2_hash_ >( "mulxp2_hash" );
|
||||
test< mulxp3_hash_ >( "mulxp3_hash" );
|
||||
|
||||
#endif
|
||||
|
||||
std::cout << "---\n\n";
|
||||
|
Reference in New Issue
Block a user