README.md
This file
Path
README.md
206 lines · 6.6 KiB · Markdown
Last changed by
README: add instructions on installing via MacPorts for macOSHerby Gillotbefore adoptiona7e2889
History of this fileTake it
The walk stopped after 200 commits: lines older than 36d7fb8 point at it.
Bump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 1–2why, one step back1# hyperfine2[](https://travis-ci.org/sharkdp/hyperfine)Show `master` build stateDavid Peterbefore adoption9f4e285
line 3why, one step back3[](https://ci.appveyor.com/project/sharkdp/hyperfine/branch/master)Bump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 4–6why, one step back4[](https://crates.io/crates/hyperfine)5[中文](https://github.com/chinanf-boy/hyperfine-zh)6Add alternative tools sectionDavid Peterbefore adoption3395914
line 7why, one step back7A command-line benchmarking tool.Bump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 8–11why, one step back89**Demo**: Benchmarking [`fd`](https://github.com/sharkdp/fd) and10[`find`](https://www.gnu.org/software/findutils/):11Update previewDavid Peterbefore adoption983a976
line 12why, one step back12Bump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 13–20why, one step back1314## Features1516* Statistical analysis across multiple runs.17* Support for arbitrary shell commands.18* Constant feedback about the benchmark progress and current estimates.19* Warmup runs can be executed before the actual benchmark.20* Cache-clearing commands can be set up before each timing run.Update READMEDavid Peterbefore adoption52cbac4
lines 21–23why, one step back21* Statistical outlier detection to detect interference from other programs and caching effects.22* Export results to various formats: CSV, JSON, Markdown, AsciiDoc.23* Parameterized benchmarks (e.g. vary the number of threads).Bump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 24–42why, one step back24* Cross-platform2526## Usage2728### Basic benchmark2930To run a benchmark, you can simply call `hyperfine <command>...`. The argument(s) can be any31shell command. For example:32``` bash33hyperfine 'sleep 0.3'34```3536Hyperfine will automatically determine the number of runs to perform for each command. By default,37it will perform *at least* 10 benchmarking runs. To change this, you can use the `-m`/`--min-runs`38option:39``` bash40hyperfine --min-runs 5 'sleep 0.2' 'sleep 3.2'41```42Change headlinesharkdpbefore adoption921f999
line 43why, one step back43### Warmup runs and preparation commandsBump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 44–72why, one step back4445If the program execution time is limited by disk I/O, the benchmarking results can be heavily46influenced by disk caches and whether they are cold or warm.4748If you want to run the benchmark on a warm cache, you can use the `-w`/`--warmup` option to perform49a certain number of program executions before the actual benchmark:50``` bash51hyperfine --warmup 3 'grep -R TODO *'52```5354Conversely, if you want to run the benchmark for a cold cache, you can use the `-p`/`--prepare`55option to run a special command before *each* timing run. For example, to clear harddisk caches56on Linux, you can run57``` bash58sync; echo 3 | sudo tee /proc/sys/vm/drop_caches59```60To use this specific command with Hyperfine, call `sudo -v` to temporarily gain sudo permissions61and then call:62``` bash63hyperfine --prepare 'sync; echo 3 | sudo tee /proc/sys/vm/drop_caches' 'grep -R TODO *'64```6566### Parameterized benchmarks6768If you want to run a benchmark where only a single parameter is varied (say, the number of69threads), you can use the `-P`/`--parameter-scan` option and call:70``` bash71hyperfine --prepare 'make clean' --parameter-scan num_threads 1 12 'make -j {num_threads}'72```Add '--parameter-step-size' to READMEDavid Peterbefore adoption9e53492
lines 73–75why, one step back73This also works with decimal numbers. The `-D`/`--parameter-step-size` option can be used74to control the step size:75``` bashSmall change to READMEsharkdpbefore adoption27f2ce6
line 76why, one step back76hyperfine --parameter-scan delay 0.3 0.7 -D 0.2 'sleep {delay}'Add '--parameter-step-size' to READMEDavid Peterbefore adoption9e53492
line 77why, one step back77```Small change to READMEsharkdpbefore adoption27f2ce6
line 78why, one step back78This runs `sleep 0.3`, `sleep 0.5` and `sleep 0.7`.Bump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 79–85why, one step back7980### Export results8182Hyperfine has multiple options for exporting benchmark results: CSV, JSON, Markdown (see `--help`83text for details). To export results to Markdown, for example, you can use the `--export-markdown`84option that will create tables like this:85Update READMEDavid Peterbefore adoption52cbac4
lines 86–87why, one step back86| Command | Mean [s] | Min [s] | Max [s] | Relative |87|:---|---:|---:|---:|---:|Update markdown exportsharkdpbefore adoption82c4a1c
lines 88–90why, one step back88| `find . -iregex '.*[0-9]\.jpg$'` | 2.275 ± 0.046 | 2.243 | 2.397 | 9.79 ± 0.22 |89| `find . -iname '*[0-9].jpg'` | 1.427 ± 0.026 | 1.405 | 1.468 | 6.14 ± 0.13 |90| `fd -HI '.*[0-9]\.jpg$'` | 0.232 ± 0.002 | 0.230 | 0.236 | 1.00 |Bump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 91–101why, one step back9192The JSON output is useful if you want to analyze the benchmark results in more detail. See the93[`scripts/`](https://github.com/sharkdp/hyperfine/tree/master/scripts) folder for some examples.9495## Installation9697### On Ubuntu9899Download the appropriate `.deb` package from the [Release page](https://github.com/sharkdp/hyperfine/releases)100and install it via `dpkg`:101```Bump versionsharkdpbefore adoption4567088
lines 102–103why, one step back102wget https://github.com/sharkdp/hyperfine/releases/download/v1.9.0/hyperfine_1.9.0_amd64.deb103sudo dpkg -i hyperfine_1.9.0_amd64.debBump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 104–105why, one step back104```105Add installation instructions for FedoraIgor Gnatenkobefore adoptionf291a1d
lines 106–113why, one step back106### On Fedora107108On Fedora, hyperfine can be installed from the official repositories:109110```sh111dnf install hyperfine112```113Add Alpine Linux installation instructionsChloe Kudryavtsevbefore adoption0006e90
lines 114–120why, one step back114### On Alpine Linux115116On Alpine Linux, hyperfine can be installed [from the official repositories](https://pkgs.alpinelinux.org/packages?name=hyperfine):117```118apk add hyperfine119```120Bump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 121–122why, one step back121### On Arch Linux122hyperfine is in the official Arch repositoriesDavid Peterbefore adoption7d308a8
line 123why, one step back123On Arch Linux, hyperfine can be installed [from the official repositories](https://www.archlinux.org/packages/community/x86_64/hyperfine/):Bump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
line 124why, one step back124```hyperfine is in the official Arch repositoriesDavid Peterbefore adoption7d308a8
line 125why, one step back125pacman -S hyperfineBump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 126–127why, one step back126```127Add NixOS instructionsDenny Schäferbefore adoption73b3eaa
lines 128–134why, one step back128### On NixOS129130On NixOS, hyperfine can be installed [from the official repositories](https://nixos.org/nixos/packages.html?query=hyperfine):131```132nix-env -i hyperfine133```134Bump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 135–140why, one step back135### On Void Linux136137Hyperfine can be installed via xbps138139```140xbps-install -S hyperfineUpdate READMEDavid Peterbefore adoption52cbac4
lines 141–147why, one step back141```142143### On macOS144145Hyperfine can be installed via [Homebrew](https://brew.sh):146```147brew install hyperfineBump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 148–149why, one step back148```149README: add instructions on installing via MacPorts for macOSHerby Gillotbefore adoptiona7e2889
lines 150–155why, one step back150Or you can install using [MacPorts](https://www.macports.org):151```152sudo port selfupdate153sudo port install hyperfine154```155Add FreeBSD installation instructionsMateusz Piotrowskibefore adoptionc856a5b
lines 156–162why, one step back156### On FreeBSD157158Hyperfine can be installed via pkg:159```160pkg install hyperfine161```162Small update to conda install instructionsDavid Peterbefore adoption06a2885
line 163why, one step back163### With condaAdd install instructions for installing via condaDaniel Bastbefore adoptionea41b55
line 164why, one step back164Small update to conda install instructionsDavid Peterbefore adoption06a2885
line 165why, one step back165Hyperfine can be installed via [`conda`](https://conda.io/en/latest/) from the [`conda-forge`](https://anaconda.org/conda-forge/hyperfine) channel:Add install instructions for installing via condaDaniel Bastbefore adoptionea41b55
lines 166–169why, one step back166```167conda install -c conda-forge hyperfine168```169Bump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 170–176why, one step back170### With cargo (Linux, macOS, Windows)171172Hyperfine can be installed via [cargo](https://doc.rust-lang.org/cargo/):173```174cargo install hyperfine175```176Bump min. required Rust version to 1.39sharkdpbefore adoptionce42dc2
line 177why, one step back177Make sure that you use Rust 1.39 or higher.Bump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 178–181why, one step back178179### From binaries (Linux, macOS, Windows)180181Download the corresponding archive from the [Release page](https://github.com/sharkdp/hyperfine/releases).Add alternative tools sectionDavid Peterbefore adoption3395914
lines 182–184why, one step back182183## Alternative tools184Add link to chronologerDavid Peterbefore adoption92bab7e
lines 185–193why, one step back185Hyperfine is inspired by [bench](https://github.com/Gabriel439/bench).186 187## Integration with other tools188189[Chronologer](https://github.com/dandavison/chronologer) is a tool that uses `hyperfine` to190visualize changes in benchmark timings across your Git history.191192Make sure to check out the [`scripts` folder](https://github.com/sharkdp/hyperfine/tree/master/scripts)193in this repository for a set of tools to work with `hyperfine` benchmark results.Bump colored from 1.6.1 to 1.7.0dependabot[bot]before adoption36d7fb8
lines 194–199why, one step back194195## Origin of the name196197The name *hyperfine* was chosen in reference to the hyperfine levels of caesium 133 which play a crucial role in the198[definition of our base unit of time](https://en.wikipedia.org/wiki/Second#History_of_definition)199— the second.Fix LICENSEShun Sakaibefore adoption880246c
lines 200–206why, one step back200201## License202Copyright (c) 2018-2020 The hyperfine developers203204`hyperfine` is distributed under the terms of both the MIT License and the Apache License 2.0.205206See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files for license details.