From 2c5b8577aa930009a064817b55ffe2148a54aefb Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 22 Jul 2022 19:10:50 +0300 Subject: [PATCH] Add tsl::robin_map to string.cpp --- benchmark/string.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/benchmark/string.cpp b/benchmark/string.cpp index a9492b8a..423cce3a 100644 --- a/benchmark/string.cpp +++ b/benchmark/string.cpp @@ -17,6 +17,9 @@ #ifdef HAVE_TSL_HOPSCOTCH # include "tsl/hopscotch_map.h" #endif +#ifdef HAVE_TSL_ROBIN +# include "tsl/robin_map.h" +#endif #include #include #include @@ -140,7 +143,14 @@ template BOOST_NOINLINE void test_iteration( Map& map, std::chrono::s { if( it->second & 1 ) { - map.erase( it++ ); + if constexpr( std::is_void_v< decltype( map.erase( it ) ) > ) + { + map.erase( it++ ); + } + else + { + it = map.erase( it ); + } } else { @@ -308,6 +318,16 @@ template using tsl_hopscotch_pg_map = #endif +#ifdef HAVE_TSL_ROBIN + +template using tsl_robin_map = + tsl::robin_map, std::equal_to, ::allocator< std::pair >>; + +template using tsl_robin_pg_map = + tsl::robin_pg_map, std::equal_to, ::allocator< std::pair >>; + +#endif + // fnv1a_hash template struct fnv1a_hash_impl; @@ -386,6 +406,16 @@ template using tsl_hopscotch_pg_map_fnv1a = #endif +#ifdef HAVE_TSL_ROBIN + +template using tsl_robin_map_fnv1a = + tsl::robin_map, ::allocator< std::pair >>; + +template using tsl_robin_pg_map_fnv1a = + tsl::robin_pg_map, ::allocator< std::pair >>; + +#endif + // int main() @@ -412,6 +442,13 @@ int main() #endif +#ifdef HAVE_TSL_ROBIN + + test( "tsl::robin_map" ); + test( "tsl::robin_pg_map" ); + +#endif + #endif test( "std::unordered_map, FNV-1a" ); @@ -430,6 +467,13 @@ int main() test( "tsl::hopscotch_map, FNV-1a" ); test( "tsl::hopscotch_pg_map, FNV-1a" ); +#endif + +#ifdef HAVE_TSL_ROBIN + + test( "tsl::robin_map, FNV-1a" ); + test( "tsl::robin_pg_map, FNV-1a" ); + #endif std::cout << "---\n\n";