{"id":13395201,"url":"https://github.com/sharkdp/hyperfine","last_synced_at":"2025-05-12T16:17:16.275Z","repository":{"id":37463891,"uuid":"117356231","full_name":"sharkdp/hyperfine","owner":"sharkdp","description":"A command-line benchmarking tool","archived":false,"fork":false,"pushed_at":"2025-05-01T02:03:20.000Z","size":1924,"stargazers_count":24897,"open_issues_count":53,"forks_count":397,"subscribers_count":99,"default_branch":"master","last_synced_at":"2025-05-05T11:45:15.282Z","etag":null,"topics":["benchmark","cli","command-line","rust","terminal","tool"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sharkdp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"sharkdp"}},"created_at":"2018-01-13T15:49:54.000Z","updated_at":"2025-05-05T09:42:46.000Z","dependencies_parsed_at":"2023-02-17T05:01:13.517Z","dependency_job_id":"bc2bebf9-3475-44c5-940e-d1ab4239acd9","html_url":"https://github.com/sharkdp/hyperfine","commit_stats":{"total_commits":881,"total_committers":93,"mean_commits":9.473118279569892,"dds":0.7695800227014756,"last_synced_commit":"64b9c715e99467312c6414e370742bd3fe5972be"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Fhyperfine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Fhyperfine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Fhyperfine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Fhyperfine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharkdp","download_url":"https://codeload.github.com/sharkdp/hyperfine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252504140,"owners_count":21758654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","cli","command-line","rust","terminal","tool"],"created_at":"2024-07-30T17:01:46.019Z","updated_at":"2025-05-05T12:50:10.555Z","avatar_url":"https://github.com/sharkdp.png","language":"Rust","readme":"# hyperfine\n[![CICD](https://github.com/sharkdp/hyperfine/actions/workflows/CICD.yml/badge.svg)](https://github.com/sharkdp/hyperfine/actions/workflows/CICD.yml)\n[![Version info](https://img.shields.io/crates/v/hyperfine.svg)](https://crates.io/crates/hyperfine)\n[中文](https://github.com/chinanf-boy/hyperfine-zh)\n\nA command-line benchmarking tool.\n\n**Demo**: Benchmarking [`fd`](https://github.com/sharkdp/fd) and\n[`find`](https://www.gnu.org/software/findutils/):\n\n![hyperfine](https://i.imgur.com/z19OYxE.gif)\n\n### Sponsors\n\nA special *thank you* goes to our biggest \u003ca href=\"doc/sponsors.md\"\u003esponsor\u003c/a\u003e:\u003cbr\u003e\n\n\u003ca href=\"https://www.warp.dev/hyperfine\"\u003e\n  \u003cimg src=\"doc/sponsors/warp-logo.png\" width=\"200\" alt=\"Warp\"\u003e\n  \u003cbr\u003e\n  \u003cstrong\u003eWarp, the intelligent terminal\u003c/strong\u003e\n  \u003cbr\u003e\n  \u003csub\u003eAvailable on MacOS, Linux, Windows\u003c/sub\u003e\n\u003c/a\u003e\n\n## Features\n\n* Statistical analysis across multiple runs.\n* Support for arbitrary shell commands.\n* Constant feedback about the benchmark progress and current estimates.\n* Warmup runs can be executed before the actual benchmark.\n* Cache-clearing commands can be set up before each timing run.\n* Statistical outlier detection to detect interference from other programs and caching effects.\n* Export results to various formats: CSV, JSON, Markdown, AsciiDoc.\n* Parameterized benchmarks (e.g. vary the number of threads).\n* Cross-platform\n\n## Usage\n\n### Basic benchmarks\n\nTo run a benchmark, you can simply call `hyperfine \u003ccommand\u003e...`. The argument(s) can be any\nshell command. For example:\n```sh\nhyperfine 'sleep 0.3'\n```\n\nHyperfine will automatically determine the number of runs to perform for each command. By default,\nit will perform *at least* 10 benchmarking runs and measure for at least 3 seconds. To change this,\nyou can use the `-r`/`--runs` option:\n```sh\nhyperfine --runs 5 'sleep 0.3'\n```\n\nIf you want to compare the runtimes of different programs, you can pass multiple commands:\n```sh\nhyperfine 'hexdump file' 'xxd file'\n```\n\n### Warmup runs and preparation commands\n\nFor programs that perform a lot of disk I/O, the benchmarking results can be heavily influenced\nby disk caches and whether they are cold or warm.\n\nIf you want to run the benchmark on a warm cache, you can use the `-w`/`--warmup` option to\nperform a certain number of program executions before the actual benchmark:\n```sh\nhyperfine --warmup 3 'grep -R TODO *'\n```\n\nConversely, if you want to run the benchmark for a cold cache, you can use the `-p`/`--prepare`\noption to run a special command before *each* timing run. For example, to clear harddisk caches\non Linux, you can run\n```sh\nsync; echo 3 | sudo tee /proc/sys/vm/drop_caches\n```\nTo use this specific command with hyperfine, call `sudo -v` to temporarily gain sudo permissions\nand then call:\n```sh\nhyperfine --prepare 'sync; echo 3 | sudo tee /proc/sys/vm/drop_caches' 'grep -R TODO *'\n```\n\n### Parameterized benchmarks\n\nIf you want to run a series of benchmarks where a single parameter is varied (say, the number of\nthreads), you can use the `-P`/`--parameter-scan` option and call:\n```sh\nhyperfine --prepare 'make clean' --parameter-scan num_threads 1 12 'make -j {num_threads}'\n```\nThis also works with decimal numbers. The `-D`/`--parameter-step-size` option can be used\nto control the step size:\n```sh\nhyperfine --parameter-scan delay 0.3 0.7 -D 0.2 'sleep {delay}'\n```\nThis runs `sleep 0.3`, `sleep 0.5` and `sleep 0.7`.\n\nFor non-numeric parameters, you can also supply a list of values with the `-L`/`--parameter-list`\noption:\n```\nhyperfine -L compiler gcc,clang '{compiler} -O2 main.cpp'\n```\n\n### Intermediate shell\n\nBy default, commands are executed using a predefined shell (`/bin/sh` on Unix, `cmd.exe` on Windows).\nIf you want to use a different shell, you can use the `-S, --shell \u003cSHELL\u003e` option:\n```sh\nhyperfine --shell zsh 'for i in {1..10000}; do echo test; done'\n```\n\nNote that hyperfine always *corrects for the shell spawning time*. To do this, it performs a calibration\nprocedure where it runs the shell with an empty command (multiple times), to measure the startup time\nof the shell. It will then subtract this time from the total to show the actual time used by the command\nin question.\n\nIf you want to run a benchmark *without an intermediate shell*, you can use the `-N` or `--shell=none`\noption. This is helpful for very fast commands (\u003c 5 ms) where the shell startup overhead correction would\nproduce a significant amount of noise. Note that you cannot use shell syntax like `*` or `~` in this case.\n```\nhyperfine -N 'grep TODO /home/user'\n```\n\n\n### Shell functions and aliases\n\nIf you are using bash, you can export shell functions to directly benchmark them with hyperfine:\n\n```bash\nmy_function() { sleep 1; }\nexport -f my_function\nhyperfine --shell=bash my_function\n```\n\nOtherwise, inline them into or source them from the benchmarked program:\n\n```sh\nhyperfine 'my_function() { sleep 1; }; my_function'\n\necho 'alias my_alias=\"sleep 1\"' \u003e /tmp/my_alias.sh\nhyperfine '. /tmp/my_alias.sh; my_alias'\n```\n\n### Exporting results\n\nHyperfine has multiple options for exporting benchmark results to CSV, JSON, Markdown and other\nformats (see `--help` text for details).\n\n#### Markdown\n\nYou can use the `--export-markdown \u003cfile\u003e` option to create tables like the following:\n\n| Command | Mean [s] | Min [s] | Max [s] | Relative |\n|:---|---:|---:|---:|---:|\n| `find . -iregex '.*[0-9]\\.jpg$'` | 2.275 ± 0.046 | 2.243 | 2.397 | 9.79 ± 0.22 |\n| `find . -iname '*[0-9].jpg'` | 1.427 ± 0.026 | 1.405 | 1.468 | 6.14 ± 0.13 |\n| `fd -HI '.*[0-9]\\.jpg$'` | 0.232 ± 0.002 | 0.230 | 0.236 | 1.00 |\n\n#### JSON\n\nThe JSON output is useful if you want to analyze the benchmark results in more detail. The\n[`scripts/`](https://github.com/sharkdp/hyperfine/tree/master/scripts) folder includes a lot\nof helpful Python programs to further analyze benchmark results and create helpful\nvisualizations, like a histogram of runtimes or a whisker plot to compare\nmultiple benchmarks:\n\n| ![](doc/histogram.png) | ![](doc/whisker.png) |\n|---:|---:|\n\n\n### Detailed benchmark flowchart\n\nThe following chart explains the execution order of various timing runs when using options\nlike `--warmup`, `--prepare \u003ccmd\u003e`, `--setup \u003ccmd\u003e` or `--cleanup \u003ccmd\u003e`:\n\n![](doc/execution-order.png)\n\n## Installation\n\n[![Packaging status](https://repology.org/badge/vertical-allrepos/hyperfine.svg?columns=3\u0026exclude_unsupported=1)](https://repology.org/project/hyperfine/versions)\n\n### On Ubuntu\n\nDownload the appropriate `.deb` package from the [Release page](https://github.com/sharkdp/hyperfine/releases)\nand install it via `dpkg`:\n```\nwget https://github.com/sharkdp/hyperfine/releases/download/v1.19.0/hyperfine_1.19.0_amd64.deb\nsudo dpkg -i hyperfine_1.19.0_amd64.deb\n```\n\n### On Fedora\n\nOn Fedora, hyperfine can be installed from the official repositories:\n\n```sh\ndnf install hyperfine\n```\n\n### On Alpine Linux\n\nOn Alpine Linux, hyperfine can be installed [from the official repositories](https://pkgs.alpinelinux.org/packages?name=hyperfine):\n```\napk add hyperfine\n```\n\n### On Arch Linux\n\nOn Arch Linux, hyperfine can be installed [from the official repositories](https://archlinux.org/packages/extra/x86_64/hyperfine/):\n```\npacman -S hyperfine\n```\n\n### On Debian Linux\n\nOn Debian Linux, hyperfine can be installed [from the testing repositories](https://packages.debian.org/testing/main/hyperfine):\n```\napt install hyperfine\n```\n\n### On Exherbo Linux\n\nOn Exherbo Linux, hyperfine can be installed [from the rust repositories](https://gitlab.exherbo.org/exherbo/rust/-/tree/master/packages/sys-apps/hyperfine):\n```\ncave resolve -x repository/rust\ncave resolve -x hyperfine\n```\n\n### On Funtoo Linux\n\nOn Funtoo Linux, hyperfine can be installed [from core-kit](https://github.com/funtoo/core-kit/tree/1.4-release/app-benchmarks/hyperfine):\n```\nemerge app-benchmarks/hyperfine\n```\n\n### On NixOS\n\nOn NixOS, hyperfine can be installed [from the official repositories](https://nixos.org/nixos/packages.html?query=hyperfine):\n```\nnix-env -i hyperfine\n```\n\n### On Flox\n\nOn Flox, hyperfine can be installed as follows.\n```\nflox install hyperfine\n```\nHyperfine's version in Flox follows that of Nix.\n\n### On openSUSE\n\nOn openSUSE, hyperfine can be installed [from the official repositories](https://software.opensuse.org/package/hyperfine):\n```\nzypper install hyperfine\n```\n\n### On Void Linux\n\nHyperfine can be installed via xbps\n\n```\nxbps-install -S hyperfine\n```\n\n### On macOS\n\nHyperfine can be installed via [Homebrew](https://brew.sh):\n```\nbrew install hyperfine\n```\n\nOr you can install using [MacPorts](https://www.macports.org):\n```\nsudo port selfupdate\nsudo port install hyperfine\n```\n\n### On FreeBSD\n\nHyperfine can be installed via pkg:\n```\npkg install hyperfine\n```\n\n### On OpenBSD\n\n```\ndoas pkg_add hyperfine\n```\n\n### On Windows\n\nHyperfine can be installed via [Chocolatey](https://community.chocolatey.org/packages/hyperfine), [Scoop](https://scoop.sh/#/apps?q=hyperfine\u0026s=0\u0026d=1\u0026o=true\u0026id=8f7c10f75ecf5f9e42a862c615257328e2f70f61), or [Winget](https://github.com/microsoft/winget-pkgs/tree/master/manifests/s/sharkdp/hyperfine):\n```\nchoco install hyperfine\n```\n```\nscoop install hyperfine\n```\n```\nwinget install hyperfine\n```\n\n### With conda\n\nHyperfine can be installed via [`conda`](https://conda.io/en/latest/) from the [`conda-forge`](https://anaconda.org/conda-forge/hyperfine) channel:\n```\nconda install -c conda-forge hyperfine\n```\n\n### With cargo (Linux, macOS, Windows)\n\nHyperfine can be installed from source via [cargo](https://doc.rust-lang.org/cargo/):\n```\ncargo install --locked hyperfine\n```\n\nMake sure that you use Rust 1.76 or newer.\n\n### From binaries (Linux, macOS, Windows)\n\nDownload the corresponding archive from the [Release page](https://github.com/sharkdp/hyperfine/releases).\n\n## Alternative tools\n\nHyperfine is inspired by [bench](https://github.com/Gabriella439/bench).\n\n## Integration with other tools\n\n[Chronologer](https://github.com/dandavison/chronologer) is a tool that uses `hyperfine` to\nvisualize changes in benchmark timings across your Git history.\n\n[Bencher](https://github.com/bencherdev/bencher) is a continuous benchmarking tool that supports `hyperfine` to\ntrack benchmarks and catch performance regressions in CI.\n\nDrop hyperfine JSON outputs onto the [Venz](https://try.venz.dev) chart to visualize the results,\nand manage hyperfine configurations.\n\nMake sure to check out the [`scripts` folder](https://github.com/sharkdp/hyperfine/tree/master/scripts)\nin this repository for a set of tools to work with `hyperfine` benchmark results.\n\n## Origin of the name\n\nThe name *hyperfine* was chosen in reference to the hyperfine levels of caesium 133 which play a crucial role in the\n[definition of our base unit of time](https://en.wikipedia.org/wiki/Second#History_of_definition)\n— the second.\n\n## Citing hyperfine\n\nThank you for considering to cite hyperfine in your research work. Please see the information\nin the sidebar on how to properly cite hyperfine.\n\n## License\n\n`hyperfine` is dual-licensed under the terms of the MIT License and the Apache License 2.0.\n\nSee the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files for details.\n","funding_links":["https://github.com/sponsors/sharkdp"],"categories":["Development tools","Rust","Software","Command Line","Benchmarking","Command Line Utilities","Tools","开发工具 Development tools","Command line","\\*nix/\\*nux","Command Line Tools","Linux System Tools","开发工具","Applications","System Utilities","语言资源库","Rust 程序设计","cli","Programming Languages","Awesome Tools","Benchmarks","Other","Linux生态圈Dev\u0026Ops工具与服务","\u003ca name=\"monitor\"\u003e\u003c/a\u003eSystem monitoring","terminal","Lovely Commands","Performance","⚡ Productivity","Command line - Linux"],"sub_categories":["Profiling","Trends","Dependency Management","Typehint","System Info / Monitoring","分析 Profiling","Benchmarking","剖析","rust","网络服务_其他","Rust","Terminal Tools","Others","Useful Linux Tools","Other","System tools","Learning resources"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkdp%2Fhyperfine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharkdp%2Fhyperfine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkdp%2Fhyperfine/lists"}