repobenchmarks // benchmarking
PRODUCTIVITY
$ hyperfine --warmup 3 'fd -e md' 'find . -name "*.md"'

hyperfine CLI Benchmarker

Statistically rigorous command-line benchmarking written in Rust. Features automatic warmup, outlier detection, and comparative analysis.

Language: Rust Statistical: Mean, Stddev, Min/Max Features: Cache clearing & warmups
Benchmark 1: fd -e md Time: 12.4 ms ± 0.8 ms Benchmark 2: find . -name "*.md" Time: 78.2 ms ± 3.2 ms Summary: 'fd' ran 6.31 ± 0.48 times faster

Evaluating the speed of command-line utilities, compile times, or database query scripts using the basic shell time builtin is fraught with statistical errors. A single run is heavily distorted by disk cache cold starts, CPU frequency throttling, and background operating system spikes. hyperfine, created by David Peter (sharkdp), brings statistical rigor to command-line benchmarking by automating warmup executions, computing statistical variance, detecting outliers, and producing publication-grade markdown and JSON comparison tables.

hyperfine Statistical Sampling Lifecycle Lifecycle showing warmup phases, statistical iterations, outlier detection, and comparative ratio calculations. 1. Warmup Phase --warmup 3 Primes VFS Cache & CPU Clocks 2. Statistical Sampling N Runs (Auto or --runs 50) Computes Mean & StdDev (±) 3. Final Summary Speedup Ratio Ranks Markdown & JSON Export
Figure 1: Multi-stage statistical execution lifecycle eliminating disk cache anomalies and system noise.

Key Features of hyperfine

  • Automatic Warmup Runs: Use --warmup 3 to run commands three times before recording metrics, ensuring CPU caches and page tables are warm.
  • Disk Cache Clearing: Benchmark true cold-disk performance using --prepare 'sync; echo 3 | sudo tee /proc/sys/vm/drop_caches' between runs.
  • Parameterized Sweeps: Use -P threads 1 16 to evaluate scaling across multiple CPU core counts in a single command.

hyperfine Command Recipe Matrix

Use Case Command Syntax
Compare Two Tools hyperfine 'fd . /usr' 'find /usr'
Warmup + Minimum Runs hyperfine --warmup 5 --min-runs 20 'python script.py'
Export to Markdown hyperfine --export-markdown benchmark.md 'cargo build'
✓ Installation
  • macOS: brew install hyperfine
  • Ubuntu / Debian: sudo apt install hyperfine
  • Rust Cargo: cargo install hyperfine

Conclusion

hyperfine transforms performance claims from subjective hunches into repeatable, scientifically sound data.

// Primary Sources & Documentation
Editorial Note: Command options verified against hyperfine v1.18+.