Benchmark Commands With hyperfine

Measure and compare the runtime of shell commands with statistics.

macOSperformancescriptingcliLow risk
Run hyperfine 'cmd1' 'cmd2' to time both commands and print a comparison.

01Command

Command
$ hyperfine 'sleep 0.1' 'sleep 0.2'

02What it does

hyperfine runs each command multiple times, discards warmup runs and reports mean, min, max and standard deviation with outlier detection. Use --warmup, --runs or --prepare to control the measurement, which makes it far more reliable than watching time output once.

03Risk

RiskLow risk
CompatibilitymacOS with Homebrew installed
!Warning: Time measured includes process startup and I/O; benchmark with realistic inputs and a quiet machine.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Homebrew formula: hyperfine
    Homebrew · vendor-doc · 2026-09-20
    Evidence: Packages hyperfine, a command-line benchmarking tool with warmup and statistical output.

Last verified: 2026-09-22 · Category: Developer