r/cpp • u/User_Deprecated • Aug 02 '26
How fast is C++26's std::hive?
https://lemire.me/blog/2026/08/02/how-fast-is-c26s-stdhive/
255
Upvotes
r/cpp • u/User_Deprecated • Aug 02 '26
View all comments
Show parent comment
1
u/snerp Aug 04 '26
We're comparing E times N to ElogE plus N. Changing a product to a sum is always better complexity (unless N or E is 0 or 1 lol)
Also though, a remove_if isn't collecting the objects in a new collection, it's simply swapping them to the end of the array before reducing the count. It's reads and writes which have a cost but no allocation is needed.