O(1) or O(no-no-no): Mastering the unordered_map

Kevin B. Carpenter

⏱ 90 mins
beginner
intermediate
11:30-13:00, Wednesday, 17th June 2026

In modern C++, std::vector is king. We justifiably reach for it as our default, cache-friendly, contiguous sequence. But what happens when your problem doesn't fit a simple array? What is the second container you should reach for?

This talk dives deep into the data that proves std::unordered_map is the undisputed #2 container in modern C++ codebases. Its dominance signifies a fundamental shift in application design: the overwhelming, performance-critical need for average-case key-value lookups.

Join this session as we move beyond "just use a hash map" and explore the critical, real-world implications of this choice. We'll start by benchmarking the classic std::map (red-black tree) against std::unordered_map (hash table) to understand precisely what you gain—and what you might lose.

But this power comes with pitfalls. An "average-case" can quickly degrade to a catastrophic without warning. We will profile and dissect the true costs of using a hash map:

  • The Hash: What makes a good hash function? We'll go beyond std::hash and learn how to write effective, fast hashers for your custom types.
  • The Collision: How do different collision-handling strategies impact performance and memory?
  • The Re-hash: What is the "load factor," and when does the hidden cost of a full table re-hash destroy your performance gains?

We'll conclude with a practical decision-making framework for when to choose std::unordered_map, when to fall back on the ordered std::map, and how std::string—the container we often forget is a container—fits into this modern landscape.

You will leave this session with the ability to stop guessing and start knowing precisely which data structure to deploy for maximum performance.


🏷 std_unordered_map
🏷 Performance
🏷 STL
🏷 Containers
🏷 Hashing
🏷 Modern C++

Kevin B. Carpenter

Kevin Carpenter, an experienced Software Engineer, excels in crafting high-availability C++ solutions for Linux and Windows, with expertise in transaction software, financial modelling, and system integration. As a Lead Project Engineer, he ensures secure, high-speed credit card transactions. In his prior position, he played a lead role in developing an interest rate risk model for large credit unions, enhancing legacy code, and optimizing ERP data integration.

Kevin actively engages in the C++ community, volunteering at conferences like ACCU, CppCon, C++ on Sea, and SwiftCraft, where he holds key positions such as Speaker Liaison and Volunteer Coordinator/Chair. His diverse contributions to the C++ community showcase his commitment to excellence and drive for collaborative growth, leaving a lasting impact in the tech world.