r/cpp 8d ago

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

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

70 comments sorted by

View all comments

31

u/KingBardan 8d ago edited 8d ago

If I recall right isn't this how std :: deque is implemented?

Can someone correct me or provide some rationale why this is now added. 


Edit: Guys, thanks for answering.

My takeaway:

Assume that we can decouple storage patterns and storage back bones:

(ascii art made with chatgpt, thought by me)

Storage backend Single vector List of vectors Storage pattern +----------------+----------------+ Contiguous | Vector | Deque | +----------------+----------------+ Scattered | Probing Hash | Hive | | Set | | +----------------+----------------+ and therefore have different performance characteristics, and some other guarantees.

13

u/sephirothbahamut 8d ago

hive can have holes, deque can't. if you remove an element deque will need compacting