Performance

The unordered associative container type is more optimized when compared to its ordered sibling.

Performance. That’s the simple reason why the unordered associative containers were so long missed in C++. In the example below, one million randomly created values are read from an std::map and std::unordered_map with 10 million values. The impressive result is that the linear access time of an unordered associative container is 20 times faster than the access time of an ordered associative container. That is just the difference between constant and logarithmic complexity O(log n) of these operations.

Get hands-on with 1200+ tech skills courses.