LinuxCommandLibrary

hyperfine

Benchmark command-line programs

TLDR

Run a basic benchmark, performing at least 10 runs

$ hyperfine '[make]'
copy

Run a comparative benchmark
$ hyperfine '[make target1]' '[make target2]'
copy

Change minimum number of benchmarking runs
$ hyperfine [[-m|--min-runs]] [7] '[make]'
copy

Perform benchmark with warmup
$ hyperfine [[-w|--warmup]] [5] '[make]'
copy

Run a command before each benchmark run (to clear caches, etc.)
$ hyperfine [[-p|--prepare]] '[make clean]' '[make]'
copy

Run a benchmark where a single parameter changes for each run
$ hyperfine [[-p|--prepare]] '[make clean]' [[-P|--parameter-scan]] [num_threads] [1] [10] '[make --jobs {num_threads]}'
copy

SYNOPSIS

hyperfine [OPTIONS] [--] <COMMAND> [<COMMAND> ...]

PARAMETERS

-h, --help
    Prints help information.

-V, --version
    Prints version information.

-n, --name
    Sets custom name for the benchmark.

-w, --warmup
    Number of warmup runs (default: 3).

-N, --runs
    Exact number of runs; overrides auto-detection.

-r, --min-runs
    Minimum number of runs (default: 10).

-R, --max-runs
    Maximum number of runs (default: 100).

-m, --min-samples
    Minimum samples for stability (default: 3 for mean/stddev).

--run-limit
    Stop after NUM runs if stable.

-p, --prepare
    Command run before each benchmark iteration.

-s, --setup
    Command run once before all benchmarks.

-c, --cleanup
    Command run once after all benchmarks.

--shell
    Shell to use for command execution (default: /bin/sh).

-i, --ignore-failure
    Continues benchmarking on command failure.

--show-output
    Displays command output during runs.

--output