OS Manuals

/usr/bin/hyperfine

A command-line benchmarking tool that times shell commands and compares their runtimes statistically

From hyperfine 2.0.0-r3 (enterprise-packages), captured 2026-11-08 by running hyperfine --help (exit 0). permalink

A command-line benchmarking tool.

Usage: hyperfine [OPTIONS] <command>...

Arguments:
  <command>...
          The command to benchmark. This can be the name of an executable, a
          command line like "grep -i todo" or a shell command like "sleep 0.5 &&
          echo test". The latter requires a shell, which can be enabled via '-S'
          or '--shell=...'. If multiple commands are given, hyperfine will show
          a comparison with the first command as the reference.

Options:
      --metrics <PRESET|METRIC[:UNIT],…>
          Performance metrics to measure, in order.

          This is either a preset name, or a comma-separated list of metrics
          with optional units. CSV exports all selected metrics; markup exports
          use the first metric. JSON always includes all collected metrics.

          Presets (use one on its own):
            default  Wall-clock time and peak RSS
            time     Wall-clock, CPU, user, and system time
            all      All available metrics

          Presets use automatic units.

          Metrics and optional units:
            Time: time_wall_clock, time_cpu, time_user, time_system
              Units: ns, us, ms, s, min, h
            Memory: memory_peak_resident
              Units: B, kB, MB, GB, TB, KiB, MiB, GiB, TiB
            Counters: cpu_cycles, instructions, cache_references,
              cache_misses, branch_misses
              Units: count, k (thousand), M (million), B (billion)

          Examples:
            --metrics time_cpu,instructions
            --metrics memory_peak_resident:MiB,time_wall_clock:ms
            --metrics time
  -w, --warmup <NUM>
          Perform NUM warmup runs before the actual benchmark. This can be used
          to fill (disk) caches for I/O-heavy programs.
  -m, --min-runs <NUM>
          Perform at least NUM runs for each command (default: 10).
  -M, --max-runs <NUM>
          Perform at most NUM runs for each command. By default, there is no
          limit.
  -r, --runs <NUM>
          Perform exactly NUM runs for each command. If this option is not
          specified, hyperfine automatically determines the number of runs.
      --env <ASSIGNMENTS>
          Set environment variables for benchmark commands and their respective
          setup, prepare, conclude, and cleanup commands. Assignments are
          space-separated and support shell-style quoting, but no shell
          expansion:

            hyperfine \
              --env 'OMP_NUM_THREADS=8 CFLAGS="-O3 -march=native"' \
              'my_command'

          Specify once for all commands or once per benchmark command:

            hyperfine \
              --env 'OMP_NUM_THREADS=8' './benchmark-cpp' \
              --env 'RAYON_NUM_THREADS=8' './benchmark-rust'

          Use an empty --env='' for no overrides. Values can contain parameter
          placeholders. For example, the following benchmarks 'my_command' with
          OMP_NUM_THREADS ranging from 1 to 8:

            hyperfine -P threads 1 8 \
              --env 'OMP_NUM_THREADS={threads}' 'my_command'
  -s, --setup <CMD>
          Execute CMD before each set of benchmark runs. This is useful for
          compiling your software with the provided parameters, or to do any
          other work that should happen once before a series of benchmark runs,
          not every time as would happen with the --prepare option.
  -p, --prepare <CMD>
          Execute CMD before each benchmark run. This is useful for clearing
          disk caches, for example.
          The --prepare option can be specified once for all commands or
          multiple times, once for each command. In the latter case, each
          preparation command will be run prior to the corresponding benchmark
          command.
  -C, --conclude <CMD>
          Execute CMD after each benchmark run. This is useful for killing
          long-running processes started (e.g. a web server started in
          --prepare), for example.
          The --conclude option can be specified once for all commands or
          multiple times, once for each command. In the latter case, each
          conclude command will be run after the corresponding benchmark
          command.
  -c, --cleanup <CMD>
          Execute CMD after the completion of all benchmarking runs for each
          individual command to be benchmarked. This is useful if the commands
          to be benchmarked produce artifacts that need to be cleaned up.
  -P, --parameter-scan <VAR> <MIN> <MAX>
          Perform benchmark runs for each value in the range MIN..MAX. Replaces
          the string '{VAR}' in each command by the current parameter value.

            Example:  hyperfine --prepare 'make clean' -P threads 1 8 'make -j
            {threads}'

          This performs benchmarks for 'make -j 1', 'make -j 2', …, 'make -j 8'.

          To have the value increase following different patterns, use shell
          arithmetic.

            Example: hyperfine --shell=bash -P size 0 3 'sleep $((2**{size}))'

          This performs benchmarks with power of 2 increases: 'sleep 1', 'sleep
          2', 'sleep 4', …
          The exact syntax may vary depending on your shell and OS.
  -D, --parameter-step-size <DELTA>
          This argument requires --parameter-scan to be specified as well.
          Traverse the range MIN..MAX in steps of DELTA, which must be positive.

            Example:  hyperfine -P delay 0.3 0.7 -D 0.2 'sleep {delay}'

          This performs benchmarks for 'sleep 0.3', 'sleep 0.5' and 'sleep 0.7'.
  -L, --parameter-list <VAR> <VALUES>
          Perform benchmark runs for each value in the comma-separated list
          VALUES. Replaces the string '{VAR}' in each command by the current
          parameter value.

          Example:  hyperfine -L compiler g++,clang++ '{compiler} -O2 main.cpp'

          This performs benchmarks for 'g++ -O2 main.cpp' and 'clang++ -O2
          main.cpp'.

          The option can be specified multiple times to run benchmarks for all
          possible parameter combinations.
      --shell <SHELL>
          Set the shell to use for executing benchmarked commands, including
          warmup runs (default: none). This can be the name or the path to the
          shell executable, or a full command line like "bash --norc". It can
          also be set to "default" to explicitly select the platform shell (sh
          on Unix, cmd.exe on Windows). It can also be set to "none" to disable
          the shell. In this case, benchmarked commands will be executed
          directly. They can still have arguments, but more complex things like
          "sleep 0.1; sleep 0.2" are not possible without a shell. Setup,
          prepare, conclude, and cleanup commands always use a shell: the
          selected shell, or the platform shell when this option is omitted or
          set to "none".
  -S
          An alias for '--shell=default' (sh on Unix, cmd.exe on Windows).
  -N
          An alias for '--shell=none'.
  -i, --ignore-failure[=<MODE>]
          Ignore failures of the benchmarked programs. Without a value or with
          'all-non-zero', all non-zero exit codes are ignored. You can also
          provide a comma-separated list of exit codes to ignore (e.g.,
          --ignore-failure=1,2).
      --style <TYPE>
          Set output style type (default: auto). Set this to 'basic' to disable
          output coloring and interactive elements. Set it to 'full' to enable
          all effects even if no interactive terminal was detected. Set this to
          'nocolor' to keep the interactive output without any colors. Set this
          to 'color' to keep the colors without any interactive output. Set this
          to 'none' to disable all the output of the tool.
      --export-asciidoc <FILE>
          Export the primary metric summary statistics as an AsciiDoc table to
          the given FILE. The unit can be set with --metrics METRIC:UNIT.
      --export-csv <FILE>
          Export summary statistics for all selected metrics as CSV to the given
          FILE. If you need all metrics for each individual run, use the JSON
          export format. Column names are prefixed with the metric name. Use the
          explicitly selected units, or base units when unspecified.
      --export-json <FILE>
          Export all collected metrics and individual runs as JSON to the given
          FILE. Values always use base units (seconds, bytes, counts).
      --export-markdown <FILE>
          Export the primary metric summary statistics as a Markdown table to
          the given FILE. The unit can be set with --metrics METRIC:UNIT.
      --export-orgmode <FILE>
          Export the primary metric summary statistics as an Emacs org-mode
          table to the given FILE. The unit can be set with --metrics
          METRIC:UNIT.
      --show-output
          Print the stdout and stderr of the benchmark instead of suppressing
          it. This will increase the time it takes for benchmarks to run, so it
          should only be used for debugging purposes or when trying to benchmark
          output speed.
      --output <WHERE>
          Control where the output of the benchmark is redirected. Note that
          some programs like 'grep' detect when standard output is /dev/null and
          apply certain optimizations. To avoid that, consider using
          '--output=pipe'.

          <WHERE> can be:

            null:     Redirect output to /dev/null (the default).

            pipe:     Feed the output through a pipe before discarding it.

            inherit:  Don't redirect the output at all (same as
            '--show-output').

            <FILE>:   Write the output to the given file.

          This option can be specified once for all commands or multiple times,
          once for each command. Note: If you want to log the output of each and
          every iteration, you can use a shell redirection and the
          '$HYPERFINE_ITERATION' environment variable:
              hyperfine -S 'my-command > output-${HYPERFINE_ITERATION}.log'
      --input <WHERE>
          Control where the input of the benchmark comes from.

          <WHERE> can be:

            null:     Read from /dev/null (the default).

            <FILE>:   Read the input from the given file.
  -n, --command-name <NAME>
          Give a meaningful name to a command. This can be specified multiple
          times if several commands are benchmarked.
  -h, --help
          Print help
  -V, --version
          Print version
Options (29)
OptionDescriptionSource
--metrics PRESET|METRIC[:UNITSelect the metrics to measure, in order, with an optional unit for each.help + man
-w, --warmup NUMPerform NUM warmup runs before the actual benchmark.help + man
-m, --min-runs NUMPerform at least NUM runs for each command (default: 10).help + man
-M, --max-runs NUMPerform at most NUM runs for each command.help + man
-r, --runs NUMPerform exactly NUM runs for each command.help + man
--env ASSIGNMENTSSet environment variables for benchmark commands and their respective setup, prepare, conclude, and cleanup commands.help + man
-s, --setup CMDExecute CMD once before each set of benchmark runs.help + man
-p, --prepare CMDExecute CMD before each benchmark run.help + man
-C, --conclude CMDExecute CMD after each benchmark run.help + man
-c, --cleanup CMDExecute CMD after the completion of all benchmarking runs for each individual command to be benchmarked.help + man
-D, --parameter-step-size DELTAThis argument requires --parameter-scan to be specified as well.help + man
--shell SHELLSet the shell to use for executing benchmarked commands, including warmup runs (default: none).help + man
-SAn alias for '--shell=default' (sh on Unix, cmd.exe on Windows).help + man
-NAn alias for '--shell=none'.help + man
-i, --ignore-failure MODEIgnore failures of the benchmarked programs.help + man
--style TYPESet output style type (default: auto).help + man
--export-asciidoc FILEExport the primary metric's summary statistics as an AsciiDoc table to the given FILE.help + man
--export-csv FILEExport summary statistics for all selected metrics as CSV to the given FILE, one row per command.help + man
--export-json FILEExport summary statistics and individual samples for all collected metrics as JSON to the given FILE.help + man
--export-markdown FILEExport the primary metric's summary statistics as a Markdown table to the given FILE.help + man
--export-orgmode FILEExport the primary metric's summary statistics as an Emacs org-mode table to the given FILE.help + man
--show-outputPrint the stdout and stderr of the benchmark instead of suppressing it.help + man
--output WHEREControl where the output of the benchmark is redirected.help + man
--input WHEREControl where the input of the benchmark comes from.help + man
-n, --command-name NAMEGive a meaningful name to a command.help + man
-h, --helpPrint helphelp + man
-V, --versionPrint versionhelp + man
-P, --parameter-scan VARPerform benchmark runs for each value in the range MIN..MAX. (in the manual page but not in --help)man
-L, --parameter-list VARPerform benchmark runs for each value in the comma-separated list of VALUES. (in the manual page but not in --help)man
Examples (5) from the manual page, untested

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.