TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 230 subscribers
Post #25274 12
between containers. The proof for this can be seen in my msvc results, which have worse hive insertion, erasure and post-erasure iteration performance for the 48-byte ("small struct") isolated benchmarks than hub, but are still faster than hub in the general use (unordered modification) tests, which also store 48-byte structs and perform insertion, erasure and iteration in the same container instance over time. Only at the highest insert/erase-to-iteration ratio (10% of container size inserted/erased per-iteration) does hub perform better. This is not an anomoly; the same pattern is visible in clang and gcc, where isolated benchmarks of insert/erase are slower in hive with post-erasure iteration only 1% faster than hub, but hive is still 8% faster for all the lower churn ratios in the unordered modification benchmarks.

* Insert is slower on average for hive under msvc except for large types, slower for clang except for large types, and slower for gcc except for large numbers of large types.

* Iteration is generally faster across compilers for hive, however it is slower for 64-bit types under clang and small structs under msvc, and there is variation based on the number of elements.

* Memory use of hub varies between 96% and 50% of the usage of hive (but only for current implementation obviously).

The main thing to take away from all this is do your own benchmarks for your own use-case. You can use the guidelines above, but results may be very different on, say, a snapdragon processor. Also as mentioned, not all scenarios suit visitation. Always good to see new variations and experiments coming out! :)

https://redd.it/1tmr7k2
@r_cpp
Reddit From the cpp community on Reddit Explore this post and more from the cpp community
More from @r_cpp
  1. Sep 29, 2026Boost.Graph 1.95 will be C++17 Dear Boost.Graph community, In two release cycles (Boost re…
  2. Sep 26, 2026Token Sequence Injection & Modern Macros: The Most Game-Changing Compile-Time Feature in C…
  3. Sep 25, 2026myStringStream.str("") Considered Harmful Under C++20 I was recently looking at some (rath…
  4. Sep 20, 2026A clever branch free optimization I'm the developer of memlz which is an extremely fast co…
  5. Sep 15, 2026Inside Boost.PolyCollection https://bannalia.blogspot.com/2026/09/inside-boostpolycollecti…
  6. Sep 11, 2026C++26: Standard Library Hardening Experiments https://www.cppstories.com/2026/hardening-ex…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →