Optimizing Go code without a blindfold
summary
A collection of concrete lessons and numbers: a naive slice copy reduces from 10 allocations to one and becomes 70% faster when preallocated; a JSON decode benchmark sits at ~10 ms per run with ~3% variance that drops to ~1% after killing noisy apps; statistical testing yields false 1% gains after repeated runs; use benchstat for variance and a CPU‑pinning tool like perlock to avoid thermal throttling and flakey results.
AI-written summary · about
chapters (10)
- 0:00Intro
- 0:21Is your program slow?
- 1:07This is a silly example.
- 2:30Benchmark demands 100%.
- 3:19However, the CPU burns.
- 3:44Air vents measuring 2 gopher feet.
- 6:18Multiple testing problem!
- 7:19don't get new data!
- 8:19benchstat to compare statistics. perflock to avoid noise.
- 12:07GOSSAFUNC=pattern go build
related talks
20mOptimizing Go code without a blindfold
29mOptimizing Go Code Without a Blindfold
51mObscure Go Optimisations
40mTwo Go programs, three different profiling techniques, all in 40 minutes
26mPractical Memory Profiling
02h 44mMeasure, don’t guess: benchmarking stories from the trenches
38mSo You Wanna Go Fast?
42mLesson's Learned Optimizing Performance of Go Code
