hyperfine executes benchmarks directly and runs setup and cleanup commands in a shell
Introduced 2026-10-07 · score 0.97
HOW TO USE IT
When benchmarking a repository command, Hyperfine runs the benchmark command directly by default. Add setup or cleanup hooks as needed; those hooks run in a shell even with `--shell=none`.
hyperfine --setup '<setup command>' --prepare '<before each run>' --conclude '<after each run>' --cleanup '<cleanup command>' '<repository command>'hyperfine -S --setup '<setup command>' --cleanup '<cleanup command>' '<repository command>'hyperfine --shell <SHELL> --setup '<setup command>' --cleanup '<cleanup command>' '<repository command>'WHY THIS HELPS
Benchmark a repository command directly while retaining shell execution for setup and cleanup steps.
BEFORE THIS CHANGE
Before v2.0.0, benchmarked commands used a platform default shell: `sh` on Unix and `cmd.exe` on Windows. Use `-S` / `--shell=default` to restore that behavior.
REQUIREMENTS AND LIMITATIONS
- Version: v2.0.0
- <repository command> (required): Executable and its arguments to benchmark; each command argument is passed directly by default.
- -S / --shell=default: Select the platform default shell for benchmarked commands: `sh` on Unix or `cmd.exe` on Windows.
- --shell <SHELL>: Select a shell for benchmarked commands; may be a shell name or path. Alternative to `-S`/`--shell=default`.
- --shell=none: Run benchmarked commands directly without an intermediate shell; this is the default in v2.0.0. Setup, prepare, conclude, and cleanup hooks still run in a shell.
- --setup <CMD>: Run once before each set of timing runs.
- --prepare <CMD>: Run before each timing run.
- --conclude <CMD>: Run after each timing run.
- --cleanup <CMD>: Run after completion of all benchmarking runs for each individual command.
- Prerequisite: Hyperfine must be installed and available as `hyperfine` on `PATH`.
- The previous default shell is stated as `sh` on Unix and `cmd.exe` on Windows.
FIRST-PARTY EVIDENCE
- https://github.com/sharkdp/hyperfine/releases/tag/v2.0.0
- https://github.com/sharkdp/hyperfine/blob/v2.0.0/README.md
Check the installed version and the source before using it. Entry JSON