Performance Hints Contents Cheatsheet

A small book about making code faster

Performance Hints

Jeff Dean and Sanjay Ghemawat spent years writing down what they actually do when they make a program faster. This is a walk through that list — estimation, measurement, and the handful of moves that keep working.

Nine chapters · after the abseil Performance Guide

The premise

Everybody quotes half a sentence of Knuth and stops thinking. The other half says to not pass up the opportunities in the critical 3%. This book is about how you find that 3% — and about the fact that if you never think about speed while you write, the profiler will hand you a flat line and no place to start.

How to read this

The chapters follow the original document's order, and that order is itself the argument. You estimate before you build, measure before you change, and then work down a ladder of leverage: the shape of the interface, then the algorithm, then how the data sits in memory, then how often you allocate, then how much work you can skip outright. Each rung is cheaper to climb than the one below it is to fix later.

The examples are C++, because the source document is C++. Don't let that put you off if you write something else. Almost nothing here is about C++ — it is about cache lines, counted operations, and how many times you cross a boundary. Those bills arrive in every language; only the syntax for avoiding them changes.

Where this comes from

Everything in this book is drawn from Performance Hints by Jeff Dean and Sanjay Ghemawat, published as part of the abseil Performance Guide. The measurements, the latency table and the percentage improvements are theirs; the explanations, the diagrams and any mistakes are this book's.

⌂ Library