Key Notes of C++Now 2018: You Can Do Better than std::unordered_map: New Improvements to Hash Table Performance by Malte Skarupke


Talk Preview

  • the delay between the hash function and the first comparison (150ns)
  • the number os cache misses (80ns)
  • the number of unnecessary comparisons (70ns)
  • even less cache misses (50ns)
  • saving memory

Baseline Performance

  • std::unordered_map<int, int>
  • std::map<int, int>
  • boost::flat_map<int, int>
  • Linear search

Successful Lookups for 4–40 Elements

  • std::unordered_map performance graph clearly shows cache…

Benchmarking Kaby Lake and Haswell memory latency using lists

“Do I Know This Already?” Quiz

How to align elements in an array using C++11 alignas specifier

“Do I Know This Already?” Quiz

The best way to return multiple values from a C++17 function

“Do I Know This Already?” Quiz

  1. Using output parameters:
    auto output_1(int &i1) { i1 = 11; return 12; }
  2. Using a local structure:
    auto struct_2() { struct _ { int i1, i2; }; return _{21, 22}; }
  3. Using an std::pair:
    auto pair_2() { return std::make_pair(31, 32); }
  4. Using an std::tuple:
    auto tuple_2() { return std::make_tuple(41, 42); }

Use Case: Why to Return Multiple Values?

If no appropriate stock image found — time to roll up the sleeves

This image created with Blender and GIMP

The end?

Creating charts, diagrams, and simple vector graphics

Screenshot of an image created in Google Slides

Why Google Office?

Creating images using Emojis and Font Awesome

Photo made with a smartphone

Follow the white rabbit 🐇

Can’t find a stock image? Let’s take it!

No pain, no gain

A smartphone, really?

When we are looking for a relevant image

The Wikipedia Mini Globe, cropped original file

Why a new source?

“Medium posts with quality images relevant to the content perform better. […] Free resources like Pexels, Pixabay, and Unsplash are great for sourcing Creative Commons-licensed images.”

Andriy Berestovskyy

I’m in love with software performance, computer networks, and a neat design. Sounds familiar? Let’s stay in touch at

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store