Update uint64 benchmarks to profile the new container, its internal table and the rc15 release candidate

This commit is contained in:
Christian Mazakas
2022-09-27 10:30:39 -07:00
parent 2eb57995dd
commit 8905157c1e

View File

@ -5,12 +5,14 @@
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
#include <boost/unordered_map.hpp>
#include <boost/unordered/unordered_flat_map.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/endian/conversion.hpp>
#include <boost/core/detail/splitmix64.hpp>
#include <boost/config.hpp>
#include <fxa_unordered/foa_unordered_rc.hpp>
#ifdef HAVE_ABSEIL
# include "absl/container/node_hash_map.h"
# include "absl/container/flat_hash_map.h"
@ -311,6 +313,29 @@ template<class K, class V> using std_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>>;
template <typename Key, typename Value> struct map_types
{
using key_type = Key;
using value_type = std::pair<const Key, Value>;
static auto& extract(const value_type& x) { return x.first; }
};
template <class Key, class Value>
using boost_unordered_detail_foa_table =
boost::unordered::detail::foa::table<map_types<Key, Value>,
absl::container_internal::hash_default_hash<Key>, std::equal_to<Key>,
allocator_for<Key, Value> >;
template <typename Key, typename Value>
using boost_unordered_flat_map = boost::unordered::unordered_flat_map<Key,
Value, absl::container_internal::hash_default_hash<Key>, std::equal_to<Key>,
allocator_for<Key, Value> >;
template <typename Key, typename Value>
using rc15_flat_map = foa_unordered_rc_map<Key, Value,
absl::container_internal::hash_default_hash<Key>, std::equal_to<Key>,
allocator_for<Key, Value> >;
#ifdef HAVE_ABSEIL
template<class K, class V> using absl_node_hash_map =
@ -347,6 +372,9 @@ int main()
test<std_unordered_map>( "std::unordered_map" );
test<boost_unordered_map>( "boost::unordered_map" );
test<boost_unordered_detail_foa_table>( "boost_unordered_detail_foa_table" );
test<boost_unordered_flat_map>( "boost::unordered_flat_map" );
test<rc15_flat_map>( "rc15_flat_map" );
test<multi_index_map>( "multi_index_map" );
#ifdef HAVE_ABSEIL
@ -374,7 +402,7 @@ int main()
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( 34 ) << ( x.label_ + ": " ) << std::setw( 5 ) << x.time_ << " ms, " << std::setw( 9 ) << x.bytes_ << " bytes in " << x.count_ << " allocations\n";
}
}