/* Benchmark of boost::container::hub against boost::container::nest * (and optionally plf::hive). Built on the shared node-container harness. * * Copyright 2026 Joaquin M Lopez Munoz. * Copyright 2026 Ion Gaztanaga. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) */ #include #if BOOST_CXX_VERSION < 202002L int main() { return 0; } #else #ifdef NDEBUG //#define LONG_BENCH #endif //#define PLF_HIVE_BENCH #include "bench_node_cont.hpp" #include #include //Container-specific fast paths for the segmented containers benchmarked here. //They are declared in namespace boost::container so the harness' unqualified //calls (erase_void / quick_emplace / quick_erase) find them through ADL and //prefer them over the generic primary templates in bench_node_cont.hpp. namespace boost { namespace container { //erase_void: hub/nest can erase without computing the next iterator. template BOOST_CONTAINER_FORCEINLINE void erase_void(hub& x, Iterator it) { x.erase_void(it); } template BOOST_CONTAINER_FORCEINLINE void erase_void(nest& x, Iterator it) { x.erase_void(it); } //quick_emplace: nest has a faster, capacity-rollback-free insertion path. template BOOST_CONTAINER_FORCEINLINE typename nest::iterator quick_emplace(nest& x, const T& v) { return x.quick_emplace(v); } //quick_erase: mirrors erase_void for the quick build path. template BOOST_CONTAINER_FORCEINLINE void quick_erase(hub& x, Iterator it) { x.erase_void(it); } template BOOST_CONTAINER_FORCEINLINE void quick_erase(nest& x, Iterator it) { x.erase_void(it); } } //namespace container } //namespace boost //Selects the two containers compared by the harness. "num" is the numerator of //the printed time ratios, "den" the denominator. The commented alternatives //mirror the experiments previously inlined in this file. struct config : bench_defaults { #if defined(PLF_HIVE_BENCH) template using num = plf::hive; static constexpr const char* num_name = "plf::hive"; #else template using num = boost::container::hub; static constexpr const char* num_name = "hub"; //template using num = boost::container::nest; //template using num = boost::container::nest > >; //template using num = boost::container::nest > >; #endif template using den = boost::container::nest; static constexpr const char* den_name = "nest"; //template using den = boost::container::hub; //template using den = boost::container::nest > >; //template using den = boost::container::nest > >; }; int main(int argc, char* argv[]) { (void)argc; (void)argv; return bench_main(); } #endif