We cover practical microbenchmarks in Go: how
BenchmarkXxx functions work with
*
testing.B, how to run iterations correctly using
b.N or
b.Loop(), why you need the timer (
b.ResetTimer(),
b.StopTimer(),
b.StartTimer()), how to run measurements with flags
-bench,
-run,
-benchtime, and why, without a sink variable, you can end up “measuring the compiler’s optimizations” rather than your code.