All posts in "Performance"

A Minimal Interface: Both Expressive And Fast Code

Published December 5, 2017 - 0 Comments
Minimal interface

Have you ever used std::inserter to insert the outputs of an STL algorithm into a sorted container such as an std::set? And if you have, weren’t you annoyed by how its interface forces you to specify the position to insert the elements in the set? I find this very annoying, because most of the time we have […]

Good news: strong types are (mostly) free in C++

Published May 5, 2017 - 3 Comments

Strong types are a simple and efficient tool for improving code expressiveness, by letting you express your intentions better to both the compiler and to your fellow human companions. This post is part of the series about strong types, that keeps growing because it is such a rich topic: Strongly typed constructors Strong types for strong […]

Return value optimizations

Published November 28, 2016 - 2 Comments

In Make your functions functional, we saw that it was preferable to have functions return objects by value, for code clarity. Now to avoid incurring performance costs by doing this, the compiler can optimize away the copies related to the return by value, if you respect a few simple rules. This post describes these optimizations and shows […]