mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +02:00
Add boost::unordered_flat_map to benchmarks
This commit is contained in:
@ -5,6 +5,7 @@
|
|||||||
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
|
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
|
||||||
|
|
||||||
#include <boost/unordered_map.hpp>
|
#include <boost/unordered_map.hpp>
|
||||||
|
#include <boost/unordered/unordered_flat_map.hpp>
|
||||||
#include <boost/multi_index_container.hpp>
|
#include <boost/multi_index_container.hpp>
|
||||||
#include <boost/multi_index/hashed_index.hpp>
|
#include <boost/multi_index/hashed_index.hpp>
|
||||||
#include <boost/multi_index/member.hpp>
|
#include <boost/multi_index/member.hpp>
|
||||||
@ -294,6 +295,9 @@ template<class K, class V> using std_unordered_map =
|
|||||||
template<class K, class V> using boost_unordered_map =
|
template<class K, class V> using boost_unordered_map =
|
||||||
boost::unordered_map<K, V, boost::hash<K>, std::equal_to<K>, allocator_for<K, V>>;
|
boost::unordered_map<K, V, boost::hash<K>, std::equal_to<K>, allocator_for<K, V>>;
|
||||||
|
|
||||||
|
template<class K, class V> using boost_unordered_flat_map =
|
||||||
|
boost::unordered_flat_map<K, V, boost::hash<K>, std::equal_to<K>, allocator_for<K, V>>;
|
||||||
|
|
||||||
#ifdef HAVE_ABSEIL
|
#ifdef HAVE_ABSEIL
|
||||||
|
|
||||||
template<class K, class V> using absl_node_hash_map =
|
template<class K, class V> using absl_node_hash_map =
|
||||||
@ -374,6 +378,9 @@ std::unordered_map<K, V, fnv1a_hash, std::equal_to<K>, allocator_for<K, V>>;
|
|||||||
template<class K, class V> using boost_unordered_map_fnv1a =
|
template<class K, class V> using boost_unordered_map_fnv1a =
|
||||||
boost::unordered_map<K, V, fnv1a_hash, std::equal_to<K>, allocator_for<K, V>>;
|
boost::unordered_map<K, V, fnv1a_hash, std::equal_to<K>, allocator_for<K, V>>;
|
||||||
|
|
||||||
|
template<class K, class V> using boost_unordered_flat_map_fnv1a =
|
||||||
|
boost::unordered_flat_map<K, V, fnv1a_hash, std::equal_to<K>, allocator_for<K, V>>;
|
||||||
|
|
||||||
template<class K, class V> using multi_index_map_fnv1a = multi_index_container<
|
template<class K, class V> using multi_index_map_fnv1a = multi_index_container<
|
||||||
pair<K, V>,
|
pair<K, V>,
|
||||||
indexed_by<
|
indexed_by<
|
||||||
@ -418,10 +425,11 @@ int main()
|
|||||||
{
|
{
|
||||||
init_indices();
|
init_indices();
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
|
|
||||||
test<std_unordered_map>( "std::unordered_map" );
|
test<std_unordered_map>( "std::unordered_map" );
|
||||||
test<boost_unordered_map>( "boost::unordered_map" );
|
test<boost_unordered_map>( "boost::unordered_map" );
|
||||||
|
test<boost_unordered_flat_map>( "boost::unordered_flat_map" );
|
||||||
test<multi_index_map>( "multi_index_map" );
|
test<multi_index_map>( "multi_index_map" );
|
||||||
|
|
||||||
#ifdef HAVE_ABSEIL
|
#ifdef HAVE_ABSEIL
|
||||||
@ -449,6 +457,7 @@ int main()
|
|||||||
|
|
||||||
test<std_unordered_map_fnv1a>( "std::unordered_map, FNV-1a" );
|
test<std_unordered_map_fnv1a>( "std::unordered_map, FNV-1a" );
|
||||||
test<boost_unordered_map_fnv1a>( "boost::unordered_map, FNV-1a" );
|
test<boost_unordered_map_fnv1a>( "boost::unordered_map, FNV-1a" );
|
||||||
|
test<boost_unordered_flat_map_fnv1a>( "boost::unordered_flat_map, FNV-1a" );
|
||||||
test<multi_index_map_fnv1a>( "multi_index_map, FNV-1a" );
|
test<multi_index_map_fnv1a>( "multi_index_map, FNV-1a" );
|
||||||
|
|
||||||
#ifdef HAVE_ABSEIL
|
#ifdef HAVE_ABSEIL
|
||||||
@ -476,7 +485,7 @@ int main()
|
|||||||
|
|
||||||
for( auto const& x: times )
|
for( auto const& x: times )
|
||||||
{
|
{
|
||||||
std::cout << std::setw( 31 ) << ( x.label_ + ": " ) << std::setw( 5 ) << x.time_ << " ms, " << std::setw( 9 ) << x.bytes_ << " bytes in " << x.count_ << " allocations\n";
|
std::cout << std::setw( 35 ) << ( x.label_ + ": " ) << std::setw( 5 ) << x.time_ << " ms, " << std::setw( 9 ) << x.bytes_ << " bytes in " << x.count_ << " allocations\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
|
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
|
||||||
|
|
||||||
#include <boost/unordered_map.hpp>
|
#include <boost/unordered_map.hpp>
|
||||||
|
#include <boost/unordered/unordered_flat_map.hpp>
|
||||||
#include <boost/multi_index_container.hpp>
|
#include <boost/multi_index_container.hpp>
|
||||||
#include <boost/multi_index/hashed_index.hpp>
|
#include <boost/multi_index/hashed_index.hpp>
|
||||||
#include <boost/multi_index/member.hpp>
|
#include <boost/multi_index/member.hpp>
|
||||||
@ -295,6 +296,9 @@ template<class K, class V> using std_unordered_map =
|
|||||||
template<class K, class V> using boost_unordered_map =
|
template<class K, class V> using boost_unordered_map =
|
||||||
boost::unordered_map<K, V, boost::hash<K>, std::equal_to<K>, allocator_for<K, V>>;
|
boost::unordered_map<K, V, boost::hash<K>, std::equal_to<K>, allocator_for<K, V>>;
|
||||||
|
|
||||||
|
template<class K, class V> using boost_unordered_flat_map =
|
||||||
|
boost::unordered_flat_map<K, V, boost::hash<K>, std::equal_to<K>, allocator_for<K, V>>;
|
||||||
|
|
||||||
#ifdef HAVE_ABSEIL
|
#ifdef HAVE_ABSEIL
|
||||||
|
|
||||||
template<class K, class V> using absl_node_hash_map =
|
template<class K, class V> using absl_node_hash_map =
|
||||||
@ -375,6 +379,9 @@ std::unordered_map<K, V, fnv1a_hash, std::equal_to<K>, allocator_for<K, V>>;
|
|||||||
template<class K, class V> using boost_unordered_map_fnv1a =
|
template<class K, class V> using boost_unordered_map_fnv1a =
|
||||||
boost::unordered_map<K, V, fnv1a_hash, std::equal_to<K>, allocator_for<K, V>>;
|
boost::unordered_map<K, V, fnv1a_hash, std::equal_to<K>, allocator_for<K, V>>;
|
||||||
|
|
||||||
|
template<class K, class V> using boost_unordered_flat_map_fnv1a =
|
||||||
|
boost::unordered_flat_map<K, V, fnv1a_hash, std::equal_to<K>, allocator_for<K, V>>;
|
||||||
|
|
||||||
template<class K, class V> using multi_index_map_fnv1a = multi_index_container<
|
template<class K, class V> using multi_index_map_fnv1a = multi_index_container<
|
||||||
pair<K, V>,
|
pair<K, V>,
|
||||||
indexed_by<
|
indexed_by<
|
||||||
@ -419,10 +426,11 @@ int main()
|
|||||||
{
|
{
|
||||||
init_indices();
|
init_indices();
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
|
|
||||||
test<std_unordered_map>( "std::unordered_map" );
|
test<std_unordered_map>( "std::unordered_map" );
|
||||||
test<boost_unordered_map>( "boost::unordered_map" );
|
test<boost_unordered_map>( "boost::unordered_map" );
|
||||||
|
test<boost_unordered_flat_map>( "boost::unordered_flat_map" );
|
||||||
test<multi_index_map>( "multi_index_map" );
|
test<multi_index_map>( "multi_index_map" );
|
||||||
|
|
||||||
#ifdef HAVE_ABSEIL
|
#ifdef HAVE_ABSEIL
|
||||||
@ -450,6 +458,7 @@ int main()
|
|||||||
|
|
||||||
test<std_unordered_map_fnv1a>( "std::unordered_map, FNV-1a" );
|
test<std_unordered_map_fnv1a>( "std::unordered_map, FNV-1a" );
|
||||||
test<boost_unordered_map_fnv1a>( "boost::unordered_map, FNV-1a" );
|
test<boost_unordered_map_fnv1a>( "boost::unordered_map, FNV-1a" );
|
||||||
|
test<boost_unordered_flat_map_fnv1a>( "boost::unordered_flat_map, FNV-1a" );
|
||||||
test<multi_index_map_fnv1a>( "multi_index_map, FNV-1a" );
|
test<multi_index_map_fnv1a>( "multi_index_map, FNV-1a" );
|
||||||
|
|
||||||
#ifdef HAVE_ABSEIL
|
#ifdef HAVE_ABSEIL
|
||||||
@ -477,7 +486,7 @@ int main()
|
|||||||
|
|
||||||
for( auto const& x: times )
|
for( auto const& x: times )
|
||||||
{
|
{
|
||||||
std::cout << std::setw( 31 ) << ( x.label_ + ": " ) << std::setw( 5 ) << x.time_ << " ms, " << std::setw( 9 ) << x.bytes_ << " bytes in " << x.count_ << " allocations\n";
|
std::cout << std::setw( 35 ) << ( x.label_ + ": " ) << std::setw( 5 ) << x.time_ << " ms, " << std::setw( 9 ) << x.bytes_ << " bytes in " << x.count_ << " allocations\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
|
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
|
||||||
|
|
||||||
#include <boost/unordered_map.hpp>
|
#include <boost/unordered_map.hpp>
|
||||||
|
#include <boost/unordered/unordered_flat_map.hpp>
|
||||||
#include <boost/multi_index_container.hpp>
|
#include <boost/multi_index_container.hpp>
|
||||||
#include <boost/multi_index/hashed_index.hpp>
|
#include <boost/multi_index/hashed_index.hpp>
|
||||||
#include <boost/multi_index/member.hpp>
|
#include <boost/multi_index/member.hpp>
|
||||||
@ -311,6 +312,9 @@ template<class K, class V> using std_unordered_map =
|
|||||||
template<class K, class V> using boost_unordered_map =
|
template<class K, class V> using boost_unordered_map =
|
||||||
boost::unordered_map<K, V, boost::hash<K>, std::equal_to<K>, allocator_for<K, V>>;
|
boost::unordered_map<K, V, boost::hash<K>, std::equal_to<K>, allocator_for<K, V>>;
|
||||||
|
|
||||||
|
template<class K, class V> using boost_unordered_flat_map =
|
||||||
|
boost::unordered_flat_map<K, V, boost::hash<K>, std::equal_to<K>, allocator_for<K, V>>;
|
||||||
|
|
||||||
#ifdef HAVE_ABSEIL
|
#ifdef HAVE_ABSEIL
|
||||||
|
|
||||||
template<class K, class V> using absl_node_hash_map =
|
template<class K, class V> using absl_node_hash_map =
|
||||||
@ -347,6 +351,7 @@ int main()
|
|||||||
|
|
||||||
test<std_unordered_map>( "std::unordered_map" );
|
test<std_unordered_map>( "std::unordered_map" );
|
||||||
test<boost_unordered_map>( "boost::unordered_map" );
|
test<boost_unordered_map>( "boost::unordered_map" );
|
||||||
|
test<boost_unordered_flat_map>( "boost::unordered_flat_map" );
|
||||||
test<multi_index_map>( "multi_index_map" );
|
test<multi_index_map>( "multi_index_map" );
|
||||||
|
|
||||||
#ifdef HAVE_ABSEIL
|
#ifdef HAVE_ABSEIL
|
||||||
@ -374,7 +379,7 @@ int main()
|
|||||||
|
|
||||||
for( auto const& x: times )
|
for( auto const& x: times )
|
||||||
{
|
{
|
||||||
std::cout << std::setw( 25 ) << ( x.label_ + ": " ) << std::setw( 5 ) << x.time_ << " ms, " << std::setw( 9 ) << x.bytes_ << " bytes in " << x.count_ << " allocations\n";
|
std::cout << std::setw( 27 ) << ( x.label_ + ": " ) << std::setw( 5 ) << x.time_ << " ms, " << std::setw( 9 ) << x.bytes_ << " bytes in " << x.count_ << " allocations\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
|
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
|
||||||
|
|
||||||
#include <boost/unordered_map.hpp>
|
#include <boost/unordered_map.hpp>
|
||||||
|
#include <boost/unordered/unordered_flat_map.hpp>
|
||||||
#include <boost/multi_index_container.hpp>
|
#include <boost/multi_index_container.hpp>
|
||||||
#include <boost/multi_index/hashed_index.hpp>
|
#include <boost/multi_index/hashed_index.hpp>
|
||||||
#include <boost/multi_index/member.hpp>
|
#include <boost/multi_index/member.hpp>
|
||||||
@ -311,6 +312,9 @@ template<class K, class V> using std_unordered_map =
|
|||||||
template<class K, class V> using boost_unordered_map =
|
template<class K, class V> using boost_unordered_map =
|
||||||
boost::unordered_map<K, V, boost::hash<K>, std::equal_to<K>, allocator_for<K, V>>;
|
boost::unordered_map<K, V, boost::hash<K>, std::equal_to<K>, allocator_for<K, V>>;
|
||||||
|
|
||||||
|
template<class K, class V> using boost_unordered_flat_map =
|
||||||
|
boost::unordered_flat_map<K, V, boost::hash<K>, std::equal_to<K>, allocator_for<K, V>>;
|
||||||
|
|
||||||
#ifdef HAVE_ABSEIL
|
#ifdef HAVE_ABSEIL
|
||||||
|
|
||||||
template<class K, class V> using absl_node_hash_map =
|
template<class K, class V> using absl_node_hash_map =
|
||||||
@ -347,6 +351,7 @@ int main()
|
|||||||
|
|
||||||
test<std_unordered_map>( "std::unordered_map" );
|
test<std_unordered_map>( "std::unordered_map" );
|
||||||
test<boost_unordered_map>( "boost::unordered_map" );
|
test<boost_unordered_map>( "boost::unordered_map" );
|
||||||
|
test<boost_unordered_flat_map>( "boost::unordered_flat_map" );
|
||||||
test<multi_index_map>( "multi_index_map" );
|
test<multi_index_map>( "multi_index_map" );
|
||||||
|
|
||||||
#ifdef HAVE_ABSEIL
|
#ifdef HAVE_ABSEIL
|
||||||
@ -374,7 +379,7 @@ int main()
|
|||||||
|
|
||||||
for( auto const& x: times )
|
for( auto const& x: times )
|
||||||
{
|
{
|
||||||
std::cout << std::setw( 25 ) << ( x.label_ + ": " ) << std::setw( 5 ) << x.time_ << " ms, " << std::setw( 9 ) << x.bytes_ << " bytes in " << x.count_ << " allocations\n";
|
std::cout << std::setw( 27 ) << ( x.label_ + ": " ) << std::setw( 5 ) << x.time_ << " ms, " << std::setw( 9 ) << x.bytes_ << " bytes in " << x.count_ << " allocations\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user