2 ms·
unordered_map is hash based. It's as fast as any other hash backed data structure. Hash performance is well defined and widely understood.
by _wldu 5y ago
unordered_map is hash based. It's as fast as any other hash backed data structure. Hash performance is well defined and widely understood.
- lpapez 5y agoThere are dozens of hash map implementations for C++, and while they all have O(1) asymptotic complexity, the runtime performance can be vastly different depending on the implementation choices. The design space of a hash based data structure is immense, but std::unordered_map is generally always avoided unless your main goal is either ease-of-use or beginner-friendliness or you simply don't care about performance. But if any of these is true for your context, then C++ is probably not the right tool for the job anyway.
- pjmlp 5y agoIn many cases C++ is the only tool for the job, unless one wants to have fun doing their own toolchain on top of the platform SDKs, or drop down to C, even worse.