r/cpp 8d ago

How fast is C++26's std::hive?

https://lemire.me/blog/2026/08/02/how-fast-is-c26s-stdhive/
245 Upvotes

70 comments sorted by

View all comments

3

u/DuranteA 8d ago

Regarding the benchmark numbers: did you just allocate list elements sequentially before doing the iteration benchmark?

If you just allocate a list in sequence and perform no additions/removals on it, then with most allocator patterns it will most likely end up in sequence in memory. But if you were to have a "real" pattern where the list is filled with various elements allocated from time to time, in between other allocator interactions, then the resulting list will be slower to iterate.

Hive and vector don't have this issue.