Skip to content
Myr

hyperfine.1

This file

Path

doc/hyperfine.1

234 lines · 6.6 KiB

Last changed by

Add --setup (-s) option, like --prepare but runs once per batchÆvar Arnfjörð Bjarmasonbefore adoption017d55a

History of this file

Take it

1.TH HYPERFINE 12.SH NAME3hyperfine \- command\-line benchmarking tool4.SH SYNOPSIS5.B hyperfine6.RB [ \-ihV ]7.RB [ \-w8.IR warmupruns ]9.RB [ \-r10.IR runs ]11.RB [ \-p12.IR cmd... ]13.RB [ \-c14.IR cmd ]15.RB [ \-s16.IR style ]17.RI [ cmd... ]18.SH DESCRIPTION19A command\-line benchmarking tool which includes:20.LP21.RS22* Statistical analysis across multiple runs23.RE24.RS25* Support for arbitrary shell commands26.RE27.RS28* Constant feedback about the benchmark progress and current estimates29.RE30.RS31* Warmup runs can be executed before the actual benchmark32.RE33.RS34* Cache-clearing commands can be set up before each timing run35.RE36.RS37* Statistical outlier detection to detect interference from other programs and caching effects38.RE39.RS40* Export results to various formats: CSV, JSON, Markdown, AsciiDoc41.RE42.RS43* Parameterized benchmarks (e.g. vary the number of threads)44.RE45.SH OPTIONS46.HP47\fB\-w\fR, \fB\-\-warmup\fR \fIwarmupruns\fP48.IP49Perform \fIwarmupruns\fP (number) before the actual benchmark. This can be used to fill50(disk) caches for I/O\-heavy programs.51.HP52\fB\-m\fR, \fB\-\-min\-runs\fR \fIminruns\fP53.IP54Perform at least \fIminruns\fP (number) runs for each command. Default: 10.55.HP56\fB\-M\fR, \fB\-\-max\-runs\fR \fImaxruns\fP57.IP58Perform at most \fImaxruns\fP (number) runs for each command. Default: no limit.59.HP60\fB\-r\fR, \fB\-\-runs\fR \fIruns\fP61.IP62Perform exactly \fIruns\fP (number) runs for each command. If this option is not specified,63\fBhyperfine\fR automatically determines the number of runs.64.HP65\fB\-s\fR, \fB\-\-setup\fR \fIcmd\fP66.IP67Execute \fIcmd\fP once before each set of timing runs. This is useful68for compiling software or doing other one-off setup.69The \fB\-\-setup\fR option can only be specified once.70.HP71\fB\-p\fR, \fB\-\-prepare\fR \fIcmd...\fP72.IP73Execute \fIcmd\fP before each timing run. This is useful for clearing disk caches,74for example.75The \fB\-\-prepare\fR option can be specified once for all commands or multiple times,76once for each command. In the latter case, each preparation command will be77run prior to the corresponding benchmark command.78.HP79\fB\-c\fR, \fB\-\-cleanup\fR \fIcmd\fP80.IP81Execute \fIcmd\fP after the completion of all benchmarking runs for each individual82command to be benchmarked. This is useful if the commands to be benchmarked83produce artifacts that need to be cleaned up.84.HP85\fB\-P\fR, \fB\-\-parameter\-scan\fR \fIvar\fP \fImin\fP \fImax\fP86.IP87Perform benchmark runs for each value in the range \fImin..max\fP. Replaces the88string '{\fIvar\fP}' in each command by the current parameter value.89.IP90.RS91Example:92.RS93\fBhyperfine\fR \fB\-P\fR threads 1 8 'make \-j {threads}'94.RE95.RE96.IP97This performs benchmarks for 'make \-j 1', 'make \-j 2', ..., 'make \-j 8'.98.RE99.HP100\fB\-D\fR, \fB\-\-parameter\-step\-size\fR \fIdelta\fP101.IP102This argument requires \fB\-\-parameter\-scan\fR to be specified as well. Traverse the103range \fImin..max\fP in steps of \fIdelta\fP.104.IP105.RS106Example:107.RS108\fBhyperfine\fR \fB\-P\fR delay 0.3 0.7 \fB\-D\fR 0.2 'sleep {delay}'109.RE110.RE111.IP112This performs benchmarks for 'sleep 0.3', 'sleep 0.5' and 'sleep 0.7'.113.HP114\fB\-L\fR, \fB\-\-parameter\-list\fR \fIvar\fP \fIvalues\fP115.IP116Perform benchmark runs for each value in the comma\-separated list of \fIvalues\fP.117Replaces the string '{\fIvar\fP}' in each command by the current parameter value.118.IP119.RS120Example:121.RS122\fBhyperfine\fR \fB\-L\fR compiler gcc,clang '{compiler} \-O2 main.cpp'123.RE124.RE125.IP126This performs benchmarks for 'gcc \-O2 main.cpp' and 'clang \-O2 main.cpp'.127.HP128\fB\-\-style\fR \fItype\fP129.IP130Set output style \fItype\fP (default: auto). Set this to 'basic' to disable output131coloring and interactive elements. Set it to 'full' to enable all effects even132if no interactive terminal was detected. Set this to 'nocolor' to keep the133interactive output without any colors. Set this to 'color' to keep the colors134without any interactive output. Set this to 'none' to disable all the output135of the tool. In hyperfine versions v0.4.0..v1.12.0 this option took the \fB\-s\fR,136short option, which is now used by \fB\--setup\fR.137.HP138\fB\-S\fR, \fB\-\-shell\fR \fIshell\fP139.IP140Set the \fIshell\fP to use for executing benchmarked commands.141.HP142\fB\-i\fR, \fB\-\-ignore\-failure\fR143.IP144Ignore non\-zero exit codes of the benchmarked programs.145.HP146\fB\-u\fR, \fB\-\-time\-unit\fR \fIunit\fP147.IP148Set the time \fIunit\fP to be used. Default: second. Possible values: millisecond, second.149.HP150\fB\-\-export\-asciidoc\fR \fIfile\fP 151.IP152Export the timing summary statistics as an AsciiDoc table to the given \fIfile\fP.153.HP154\fB\-\-export\-csv\fR \fIfile\fP155.IP156Export the timing summary statistics as CSV to the given \fIfile\fP. If you need the157timing results for each individual run, use the JSON export format.158.HP159\fB\-\-export\-json\fR \fIfile\fP160.IP161Export the timing summary statistics and timings of individual runs as JSON to162the given \fIfile\fP.163.HP164\fB\-\-export\-markdown\fR \fIfile\fP165.IP166Export the timing summary statistics as a Markdown table to the given \fIfile\fP.167.HP168\fB\-\-show\-output\fR169.IP170Print the stdout and stderr of the benchmark instead of suppressing it. This171will increase the time it takes for benchmarks to run, so it should only be172used for debugging purposes or when trying to benchmark output speed.173.HP174\fB\-n\fR, \fB\-\-command\-name\fR \fIname\fP175.IP176Identify a command with the given \fIname\fP. Commands and names are paired in177the same order: the first command executed gets the first name passed as178option.179.HP180\fB\-h\fR, \fB\-\-help\fR181.IP182Print help message.183.HP184\fB\-V\fR, \fB\-\-version\fR185.IP186Show version information.187.SH EXAMPLES188.LP189Basic benchmark of 'find . -name todo.txt':190.RS191.nf192\fBhyperfine\fR 'find . -name todo.txt'193.fi194.RE195.LP196Perform benchmarks for 'sleep 0.2' and 'sleep 3.2' with a minimum 5 runs each:197.RS198.nf199\fBhyperfine\fR \fB\-\-min\-runs\fR 5 'sleep 0.2' 'sleep 3.2'200.fi201.RE202.LP203Perform a benchmark of 'grep' with a warm disk cache by executing 3 runs up front that are not part204of the measurement: 205.RS206.nf207\fBhyperfine\fR \fB\-\-warmup\fR 3 'grep -R TODO *'208.fi209.RE210.LP211Export the results of a parameter scan benchmark to a markdown table: 212.RS213.nf214\fBhyperfine\fR \fB\-\-export\-markdown\fR output.md \fB\-\-parameter-scan\fR time 1 5 'sleep {time}'215.fi216.RE217.LP218Demonstrate when each of \fB\-\-setup\fR, \fB\-\-prepare\fR, \fIcmd\fP and \fB\-\-cleanup\fR will run:219.RS220.nf221\fBhyperfine\fR \fB\-L\fR n 1,2 \fB\-r\fR 2 \fB\-\-show-output\fR \\222	\fB\-\-setup\fR 'echo setup n={n}' \\223	\fB\-\-prepare\fR 'echo prepare={n}' \\224	\fB\-\-cleanup\fR 'echo cleanup n={n}' \\225	'echo command n={n}'226.fi227.RE228.RE229.SH AUTHOR230.LP231David Peter (sharkdp)232.LP233Source, bug tracker, and additional information can be found on GitHub at:234.I https://github.com/sharkdp/hyperfine