benchmarking-with-hyperfinelisted
Install: claude install-skill msewell/agent-stuff
# Benchmarking with Hyperfine
## Default workflow
1. Clarify the benchmark question before running anything:
- Comparing alternatives? Use the same input, cache story, and environment for all commands.
- Checking a regression? Lock the baseline with `--reference` unless parameter sweeps require listing the baseline as a normal command.
- Measuring I/O? Decide whether the user needs warm-cache, cold-cache, or both.
- Measuring a build? Decide whether clean-build time or incremental-build time matters.
2. Verify the tool: run `hyperfine --version`. If it is older than the flags needed, ask to install or pin a newer release.
3. Start from the closest recipe, then adapt only what the task needs:
- Compare commands: `hyperfine --warmup 3 'cmd-a' 'cmd-b'`
- Very fast command: `hyperfine -N --warmup 5 --min-runs 200 './bin'`
- Clean build: `hyperfine --prepare 'make clean' 'make -j8'`
- Numeric sweep: `hyperfine -P threads 1 16 'make -j {threads}'`
- List sweep: `hyperfine -L compiler gcc,clang '{compiler} -O2 main.c'`
- Named commands: `hyperfine -n old './old' -n new './new'`
- Locked baseline: `hyperfine --reference './main' './candidate'`
- Export: `hyperfine --export-json r.json --export-markdown r.md 'cmd'`
4. Control noise before trusting results:
- Close heavy background processes.
- Use `--warmup 3` for normal warm-cache timings.
- Use `--prepare` to reset state before every run when measuring cold-cache or clean-state behavior