DevLogTechnical writing
Tutorials

hyperfine: Stop Guessing, Start Measuring Your Shell Commands

October 27, 2026

If you have ever chosen between two commands by running time once and squinting at the output, you know the drill: run it again, different number. Run it again, different again. One measurement is a guess with a timestamp.

hyperfine is the fix. It is a command-line benchmarking tool written in Rust by David Peter — the same person behind fd and bat — and it has sat at roughly 29,000 GitHub stars since 2018. The name comes from the hyperfine levels of caesium-133, the atomic transition that defines the second. The project's mission, in one word: measure time properly.

Install it the usual ways:

brew install hyperfine        # macOS
sudo apt install hyperfine    # Debian and Ubuntu
cargo install hyperfine       # everything else

Basic use is one line:

hyperfine 'sleep 0.3'

hyperfine will not run it once and call it a day. By default it performs at least 10 runs and keeps measuring until it has roughly three seconds of data, then reports mean, standard deviation, min, and max — with an outlier detector to flag runs disturbed by a stray background process. You get a number you can trust instead of a number you got once.

Comparing two tools is just as easy:

hyperfine 'hexdump file.bin' 'xxd file.bin'

The first command becomes the reference; every other result is shown as a relative speedup. The project's own README demo pits find against fd on a search for numbered JPG files: the find variant with a regex clocks 2.275 ± 0.046 seconds; fd finishes in 0.232 ± 0.002 — roughly 9.8 times faster.

The flags are where hyperfine earns its keep:

One gotcha changed recently. Since v2.0.0 — released October 7, 2026 — commands run directly, without an intermediate shell, by default. Pipes, redirects, and wildcards need the -S flag to opt back into shell mode. It is a breaking change, but a good one: a shell's startup time used to add noise to measurements of fast commands.

The same release added new metrics beyond wall time — peak memory usage, CPU cycles, cache misses, branch misses — and a new JSON export schema (the old results[i].mean now lives at results[i].summary.time_wall_clock.mean).

None of this replaces profiling your actual code. But the next time you are about to write "this tool is faster, trust me" into a review comment, run hyperfine 'grep -R TODO .' 'rg TODO .' first and paste the table. Numbers beat vibes. Sure, you could script your own loop — for i in {1..10}; do time cmd; done — but then you are doing the averaging, eyeballing outliers, and hoping nothing else was running. hyperfine handles the statistics so you can stay on the question that matters: which one is actually faster? If you need exact control, --runs 5 pins a run count, while --min-runs only sets a floor — handy when the command is slow and the default three-second measuring window is more than you want to wait. It runs on Linux, macOS, and Windows, so the habit carries everywhere.

← More Tutorials