README.md
This file
Path
README.md
96 lines · 3.0 KiB · Markdown
Last changed by
added void linux install to readmeWilson Birneybefore adoption8fdd6b5
History of this fileTake it
Add READMEDavid Peterbefore adoptionf8cbb33
line 1why, one step back1# hyperfineAdd badgesDavid Peterbefore adoption0a77b43
lines 2–3why, one step back2[](https://travis-ci.org/sharkdp/hyperfine)3[](https://crates.io/crates/hyperfine)Add READMEDavid Peterbefore adoptionf8cbb33
line 4why, one step back4Update README.mdDavid Peterbefore adoption1fe3c66
line 5why, one step back5A command-line benchmarking tool (*inspired by [bench](https://github.com/Gabriel439/bench)*).Add READMEDavid Peterbefore adoptionf8cbb33
line 6why, one step back6Rename --setup to --preparesharkdpbefore adoptiona656fbe
lines 7–8why, one step back7**Demo**: Benchmarking [`fd`](https://github.com/sharkdp/fd) and8[`find`](https://www.gnu.org/software/findutils/):Add READMEDavid Peterbefore adoptionf8cbb33
line 9why, one step back9Update READMEDavid Peterbefore adoptioncaff4e1
lines 10–11why, one step back1011Add READMEDavid Peterbefore adoptionf8cbb33
lines 12–13why, one step back12## Features13Add Ubuntu install instructionsDavid Peterbefore adoptiona08581e
lines 14–18why, one step back14* Statistical analysis across multiple runs.15* Support for arbitrary shell commands.16* Constant feedback about the benchmark progress and current estimates.17* Warmup runs can be executed before the actual benchmark.18* Cache-clearing commands can be set up before each timing run.TypoDavid Peterbefore adoptiona526f4c
line 19why, one step back19* Statistical outlier detection.Add Usage sectionDavid Peterbefore adoptiond5e02ff
lines 20–24why, one step back2021## Usage2223### Basic benchmark24Rename --setup to --preparesharkdpbefore adoptiona656fbe
lines 25–26why, one step back25To run a benchmark, you can simply call `hyperfine <command>...`. The argument(s) can be any26shell command. For example:Add Usage sectionDavid Peterbefore adoptiond5e02ff
line 27why, one step back27``` bashRemove prompt charactersDavid Peterbefore adoptioncda5816
line 28why, one step back28hyperfine 'sleep 0.3'Add Usage sectionDavid Peterbefore adoptiond5e02ff
lines 29–30why, one step back29```30Rename --setup to --preparesharkdpbefore adoptiona656fbe
lines 31–33why, one step back31Hyperfine will automatically determine the number of runs to perform for each command. By default,32it will perform *at least* 10 benchmarking runs. To change this, you can use the `-m`/`--min-runs`33option:Add Usage sectionDavid Peterbefore adoptiond5e02ff
line 34why, one step back34``` bashRemove prompt charactersDavid Peterbefore adoptioncda5816
line 35why, one step back35hyperfine --min-runs 5 'sleep 0.2' 'sleep 3.2'Add Usage sectionDavid Peterbefore adoptiond5e02ff
lines 36–39why, one step back36```3738### I/O-heavy programs39Rename --setup to --preparesharkdpbefore adoptiona656fbe
line 40why, one step back40If the program execution time is limited by disk I/O, the benchmarking results can be heavilyAnother typoDavid Peterbefore adoption1068db5
line 41why, one step back41influenced by disk caches and whether they are cold or warm.Add Usage sectionDavid Peterbefore adoptiond5e02ff
line 42why, one step back42Rename --setup to --preparesharkdpbefore adoptiona656fbe
lines 43–44why, one step back43If you want to run the benchmark on a warm cache, you can use the `-w`/`--warmup` option to perform44a certain number of program executions before the actual benchmark:Add Usage sectionDavid Peterbefore adoptiond5e02ff
line 45why, one step back45``` bashRemove prompt charactersDavid Peterbefore adoptioncda5816
line 46why, one step back46hyperfine --warmup 3 'grep -R TODO *'Add Usage sectionDavid Peterbefore adoptiond5e02ff
lines 47–48why, one step back47```48Rename --setup to --preparesharkdpbefore adoptiona656fbe
lines 49–51why, one step back49Conversely, if you want to run the benchmark for a cold cache, you can use the `-p`/`--prepare`50option to run a special command before *each* timing run. For example, to clear harddisk caches51on Linux, you can runAdd Usage sectionDavid Peterbefore adoptiond5e02ff
lines 52–54why, one step back52``` bash53sync; echo 3 | sudo tee /proc/sys/vm/drop_caches54```Recommend use of `sudo -v` over `sudo echo`Anthony Sombefore adoptione4e9377
line 55why, one step back55To use this specific command with Hyperfine, call `sudo -v` to temporarily gain sudo permissionsRename --setup to --preparesharkdpbefore adoptiona656fbe
line 56why, one step back56and then call:Add Usage sectionDavid Peterbefore adoptiond5e02ff
line 57why, one step back57``` bashRename --setup to --preparesharkdpbefore adoptiona656fbe
line 58why, one step back58hyperfine --prepare 'sync; echo 3 | sudo tee /proc/sys/vm/drop_caches' 'grep -R TODO *'Add Usage sectionDavid Peterbefore adoptiond5e02ff
line 59why, one step back59```Update READMEsharkdpbefore adoptione167b41
lines 60–62why, one step back6061## Installation62Update README.mdDavid Peterbefore adoption1fe3c66
line 63why, one step back63Hyperfine can be installed via [cargo](https://doc.rust-lang.org/cargo/):Update READMEsharkdpbefore adoptione167b41
lines 64–66why, one step back64```65cargo install hyperfine66```Add READMEDavid Peterbefore adoptionf8cbb33
line 67why, one step back67Add Arch Linux instructionsDavid Peterbefore adoptionb0bab45
lines 68–73why, one step back68### Arch Linux6970On Arch Linux, hyperfine can be installed [from the AUR](https://aur.archlinux.org/packages/hyperfine):71```72yaourt -S hyperfine73```Add Ubuntu install instructionsDavid Peterbefore adoptiona08581e
lines 74–79why, one step back7475### Ubuntu7677Download the appropriate `.deb` package from the [Release page](https://github.com/sharkdp/hyperfine/releases)78and install it via `dpkg`:79```Updates for 0.4.0sharkdpbefore adoption89e6d37
lines 80–81why, one step back80wget https://github.com/sharkdp/hyperfine/releases/download/v0.4.0/hyperfine_0.4.0_amd64.deb81sudo dpkg -i hyperfine_0.4.0_amd64.debAdd Ubuntu install instructionsDavid Peterbefore adoptiona08581e
lines 82–83why, one step back82```83added void linux install to readmeWilson Birneybefore adoption8fdd6b5
lines 84–90why, one step back84### Void Linux8586Hyperfine can be installed via xbps8788```89xbps-install -S hyperfine90```Add Arch Linux instructionsDavid Peterbefore adoptionb0bab45
line 91why, one step back91Add READMEDavid Peterbefore adoptionf8cbb33
lines 92–96why, one step back92## Origin of the name9394The name *hyperfine* was chosen in reference to the hyperfine levels of caesium 133 which play a crucial role in the95[definition of our base unit of time](https://en.wikipedia.org/wiki/Second#Based_on_caesium_microwave_atomic_clock)96— the second.