best-of lets you check the runtime of program executions.
Go to the releases page and download the latest binary for your system.
Or use go install:
go install github.com/rwxd/best-of@latestRefer to https://github.com/rwxd/my-nixpkgs for the nix package.
Set the number of executions with the -n flag (default 10).
$ best-of -n 3 -- grep -r "foo" .
Best: 0.031332 seconds
Worst: 0.031558 seconds
Average: 0.031477 secondsChange the output format with the -o flag.
$ best-of -o ms -- grep -r "foo" .
Best: 31.308470 milliseconds
Worst: 31.962246 milliseconds
Average: 31.662080 millisecondsQuiet the output of the programs with the -q flag.
$ best-of -q -- grep -r "foo" .
Best: 0.030725 seconds
Worst: 0.031578 seconds
Average: 0.031138 secondsUse concurrent executions with the -c flag (default 1).
$ best-of -c 10 -- grep -r "foo" .
Best: 0.030725 seconds
Worst: 0.031578 seconds
Average: 0.031138 secondsGet percentiles with the -p flag.
$ best-of -p -q -n 500 -- grep -r "foo" .
Best: 0.030763 seconds
Worst: 0.034639 seconds
Average: 0.031361 seconds
Median: 0.031313 seconds
90th percentile: 0.031742 seconds
95th percentile: 0.031873 seconds
99th percentile: 0.032652 secondsWait between runs with the -w flag (default 0).
best-of -w 3s -- grep -r "foo" .Show a progress bar with the --progress flag.
$ best-of -q -n 100 --progress -- grep -r "foo" .
[==================================================] 100%
Best: 0.030471 seconds
Worst: 0.033867 seconds
Average: 0.031123 seconds