Skip to content

Performance mindset and correctness first

I'd argue performance is the one area in C++ engineering where it's easiest to be confidently wrong. Microarchitecture complexity runs far ahead of human intuition — change code by feel, and nine times out of ten you're optimizing the 5% while the real bottleneck lies in the other 95%. So the first thing this volume does isn't teach you any single trick; it sets the mindset first: correctness first, then speed; measure first, then optimize.

This chapter does three things. With a piece of O(logn) lookup code, it pins down why efficiency (algorithmic complexity) and performance (real behavior on hardware) are not the same thing. It lays down the two iron rules and the Amdahl ceiling that run through the whole volume. And it settles the sanitizer toolchain as the "correctness foundation" — any performance number without correctness backing it is not to be trusted.

This chapter is the volume's thesis entry point. ch01's benchmark methodology picks up from here, swapping "I feel like" for "I measured it".

In this chapter

v0.7.1-2-g3718060 · 3718060 · 2026-07-06