Sign in

on software performance and IP networks

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

A very good talk from 2018 with tons of details for the variety of hash tables and techniques.

Very insightful for anyone interested in hash tables customization.


Talk Preview

Improve the std::unordered_map (300ns) by reducing:

  • 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

A new hash table at the end with all the bells and whistles, 50ns lookup time!

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

Modern CPUs are complex beasts with billions of transistors. This complexity in hardware brings indeterminacy even in simple software algorithms.

Let’s benchmark a simple list traversal. An average node access latency corresponds to CPU cache latencies. Or does it? Let’s put it to the test!

“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

What is the best way to return multiple values from a C++17 function?

  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); }

The answer is at the very bottom of the article.

Use Case: Why to Return Multiple Values?

A typical example is the std::from_chars(), a C++17 function similar to strtol(). …

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

Design basics — is a necessary evil we need to master to succeed in self-publishing. When all usual image sources are exhausted, time to go beyond the limits…

The end?

Creating charts, diagrams, and simple vector graphics

Good images make our article, blog post, or presentation perform better. Office suites allow creating simple vector graphics with ease. For illustration purposes, this article uses images made with free Google Office Suite.

Why Google Office?

There are a variety of free multi-platform offices, like LibreOffice or OpenOffice. There are commercial office suits, like Microsoft Office or iWork from Apple. They all might do well and the techniques described here are valid.

Yet, we will focus on Google Office Suite. It is simpler than above-mentioned alternatives, so it is easier to learn. It covers all the basic needs. It adds real-time collaboration. …

Creating images using Emojis and Font Awesome

Good images make our article, blog post, or presentation look better. There are also fonts which might be used instead.

Follow the white rabbit 🐇

We think of “fonts” as of sets of monochromatic letters and digits, with different styles, weight, and design. But we can also add a colorful smiley 😉 to our message and then send it. Do we send those smileys as built-in images?

Not really. In fact, each smiley is encoded as a single Unicode character. Just like other symbols in our message, each smiley has its own unique code. …

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

Good images make a blog post, article or presentation perform better. Original images make our work distinguish and unique. Creating those images might be a fun! For illustration purposes, this article uses images made with a smartphone.

A smartphone, really?

Back in 2005, Canon announced their first “affordable” full-frame digital camera EOS 5D. One could buy this 12.8 megapixels and more than one-kilo beauty for “just” $3500.

When we are looking for a relevant image

Relevant images help the readers to dive into the topic. But finding relevant images might be a challenge.

Why a new source?

Medium guidelines read:

“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.”

So, there are resources of good and free images, end of the story? Not! Relevant images help readers to submerge into the topic. But stock images queries sometimes bring nothing.


on software performance and IP networks

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