Hacker News new | ask | show | jobs
by ebikelaw 2842 days ago
It is very rare that I have seen a use of std::set that seemed justified, although it does happen. People just use it because it's easier to type than unordered_set!

One way to speed up set's usually appalling performance is to give it a custom allocator so that instead of N calls to allocate tiny tree nodes all over the heap, you get all your tree nodes on an arena. This can dramatically speed up short-lived sets (for example you are trying to build the unique set of some non-unique input).