C++

A 18-post collection


RSS feed of posts tagged C++

Random distributions are not one-size-fits-all (part 1)

Recently I was again on CppCast, and again I talked about C++'s standard library support for random numbers. One of the things I said was that random distributions are not one-size-fits-all. This post is about how this applies to Lemire's algorithm for generating uniformly distributed integers. »

The Little Things: The Missing Performance in std::vector

`std::vector` is often said to be the default container, because it provides good baseline performance for common operations. Recently, I experimented with a simple API change that can improve the performance of a common usage pattern by 10+ %. »

The Little Things: Why you should always have benchmarks ready

At the end of January, I removed some low-hanging allocations from Catch2. This meant that running the SelfTest binary in v3.3.1 made 8k fewer allocations, but it also made section tracking in v3.3.1 ~4x slower. This post is about how that happened and what we can learn from this. »

NDC TechTown 2022: Trip Report

Last week I was at NDC TechTown 2022, and I decided to write down my thoughts on the talks I saw (including the two talks given at the meetup before the conference) and other related things. »

The Little Things: Testing with Catch2

In this post, we will take a look at testing with Catch2. First, we will go over the basics, and then we will take a closer look at three more advanced features: Matchers, Generators, and Benchmarking. »

The Little Things: Everyday efficiencies

Premature optimization is often said to be the root of all evil, because it makes future maintenance harder. I want to show some cases where the faster code is just (or more) as maintainable as the slower one. »

The Little Things: Speeding up C++ compilation

This post is based on an internal training I prepared for my employer, Locksley, and showcases some source-level techniques for improving C++ compilation times. »

Generating random numbers using C++ standard library: the solutions

Last week I wrote about the various problem with using C++'s standard library (mainly <random>) to generate random numbers. This week I will outline what I think are the (standardizable) solutions to fix the functionality in <random> and make it widely usable. »