Hyperfine is a command-line benchmarking tool written in Rust. It's for developers, sysadmins, and anyone who needs to compare the performance of commands, scripts, or binaries without writing a custom timing harness. Instead of running time in a loop and doing math by hand, you point hyperfine at one or more commands and it handles repeated runs, statistics, and outlier detection for you.
The tool runs each command directly by default (no shell overhead), though you can opt into shell execution with -S when you need pipes, redirects, or wildcards. It automatically figures out how many runs to perform based on a target duration, or you can set an exact count. When comparing multiple commands, the first one becomes the baseline and later results show percentage change and speedup factor relative to it.
--warmup runs a command a few times before measuring (warm cache), and --prepare runs a setup command before every measured run (useful for cold-cache or clean-state benchmarks).--parameter-scan and --parameter-list let you sweep a numeric range or a list of values (thread counts, compilers, git branches) across a template command.--setup, --conclude, and --cleanup commands run outside the measured window, so one-time work (like switching git branches) doesn't pollute the timing.-S, or a specific shell like zsh or bash (including exported shell functions).--env sets variables per command or globally, and supports parameter placeholders.Hyperfine fits well when you're comparing two or more implementations of the same task: two CLI tools that do the same job (like find vs fd), two compiler flags, two versions of a script, or performance across git branches using --setup 'git switch {branch}'. It's also useful for tracking down regressions in build scripts or CI pipelines where you want a quick, statistically sound comparison without building custom tooling.
It's a good fit for benchmarking short-to-medium running commands (milliseconds to seconds) where shell startup overhead or system noise could otherwise distort results, since hyperfine corrects for shell spawn time and flags outliers.
It is not the right tool for profiling where time is spent inside a single process (use a profiler for that), nor for benchmarking long-running services or workloads that need sustained load testing over minutes or hours. It's also not designed for microbenchmarking at the sub-millisecond level inside application code; that's better handled by language-specific benchmarking frameworks.
Hyperfine is packaged for most major platforms. A few common options:
Linux (Debian/Ubuntu):
apt install hyperfine
Fedora:
dnf install hyperfine
Arch Linux:
pacman -S hyperfine
macOS (Homebrew):
brew install hyperfine
Windows (Winget):
winget install hyperfine
From source with cargo (Linux, macOS, Windows), requires Rust 1.97 or newer:
cargo install --locked hyperfine
You can also install via conda-forge, Flox, Chocolatey, Scoop, or download a prebuilt binary from the GitHub Releases page. After installing, run a basic benchmark to confirm it works:
hyperfine 'sleep 0.3'