hyperfine 2.0
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Peter · committed by David Peter · parent 26760e8 · Browse files · 6 files·+28 added−27 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+28 added−27 removed
- other:+28 added−27 removed
Provenance
- Commit
b33755f- Tree
cd88934- Author
David Peter <mail@david-peter.de>- Committer
David Peter <sharkdp@users.noreply.github.com>- Parent
26760e8
6 files changed+28 added−27 removed
modified:Cargo.lock+1 added-1 removed
375 unmodified lines376 checksum = "15cdd26707701c53297e2fa6afb323d55fbc1d0810c3aec078ae3ef0424c3c15"377 378 [[package]]379 name = "hyperfine"380-version = "2.0.0-alpha.2"380+version = "2.0.0"381 dependencies = [382 "anyhow",383 "approx",384 "assert_cmd",827 unmodified linesmodified:Cargo.toml+1 added-1 removed
5 unmodified lines678910101112131475 unmodified lines5 unmodified lineslicense = "MIT OR Apache-2.0"name = "hyperfine"readme = "README.md"repository = "https://github.com/sharkdp/hyperfine"version = "2.0.0-alpha.2"version = "2.0.0"edition = "2018"build = "build.rs"rust-version = "1.97.0"
75 unmodified linesmodified:CHANGELOG.md+22 added-21 removed
1-# v2.0.0-alpha.21+# v2.0.02 3-## Changes3+See the breaking changes below when migrating from hyperfine 1.x.4 5-- Always run `--setup`, `--prepare`, `--conclude`, and `--cleanup` commands in a shell, even when benchmarked commands run directly. Improve error messages for these commands, see #990 (@sharkdp).6-- Require an explicit shell choice for commands containing unquoted, standalone shell operators such as `&&` or `>`: use `-S` to interpret shell syntax or `-N` to pass operators as literal arguments (@sharkdp).7-- Use a compact output layout on narrow terminals (@sharkdp).8-- Make plotting and analysis scripts runnable directly from GitHub with `uvx --from 'git+https://github.com/sharkdp/hyperfine' <script>` (@sharkdp).5+## Features6 10-# v2.0.0-alpha.17+- Add support for alternative performance metrics (peak memory usage, instructions, CPU cycles, cache misses, branch misses, ...). By default, hyperfine will now display wall-clock time and peak memory usage, but users can use the [new `--metrics` option](README.md#choosing-metrics-and-units) to select different performance metrics. The terminal output now shows an overview of all selected performance metrics, including relative changes.8+- Add `--env` to set environment variables even without an intermediate shell (which is the new default behavior, see below). For example:9 12-This is the first alpha release of hyperfine 2.0. Command-line options and export formats may change before the stable release. See the breaking changes below when migrating from hyperfine 1.x.10+ ```sh11+ # Parameterized benchmark, comparing different thread counts:12+ hyperfine -P threads 1 8 --env 'OMP_NUM_THREADS={threads}' 'my_command'13+ ```14 14-## Features15+- The plotting and analysis scripts now support different metrics as well, see #981 and #984 (@sharkdp).16 16-- Add support for alternative performance metrics (peak memory usage, CPU cycles, instructions, cache misses, branch misses, ...). By default, hyperfine will now display wall-clock time and peak memory usage (wall-clock time only on Windows),17- but users can use the new `--metrics` option to select different performance metrics.18-- The terminal output now shows an overview of all selected performance metrics, including relative changes.19-- Python plotting and analysis scripts support the new JSON format and can select performance metrics with `--metric`, see #981 and #984 (@sharkdp).20-17 ## Breaking changes18 23-- Benchmarked commands are now executed directly by default, without an intermediate shell (`--shell=none`). Use `-S` (an alias for `--shell=default`) to restore the previous behavior (`sh` on Unix, `cmd.exe` on Windows), or select a shell with `--shell <SHELL>`.24-- The JSON format for `--export-json` has changed (schema version 2). The new format now includes metadata, per-run measurements, and statistical summaries for all measured quantities, see #790 (@sharkdp). Code that reads those exported JSON files must be updated. For example, `results[i].mean` is now `results[i].summary.time_wall_clock.mean`, and `results[i].times` is replaced by `results[i].measurements[j].time_wall_clock.value`. The new structure looks like this:19+- Benchmarked commands are now executed directly by default, without an intermediate shell (`--shell=none`). Use `-S` (an alias for `--shell=default`) to restore the previous behavior (`sh` on Unix, `cmd.exe` on Windows), or select a shell with `--shell <SHELL>`. See [the rationale for this change](https://github.com/sharkdp/hyperfine/issues/787#issuecomment-6038898252).20+- Always run `--setup`, `--prepare`, `--conclude`, and `--cleanup` commands in a shell, even when using `--shell=none` (the new default behavior), see #990 (@sharkdp).21+- The JSON format for `--export-json` has changed (schema version 2). The [new format](README.md#json) now includes metadata, per-run measurements, and statistical summaries for all measured quantities, see #790 (@sharkdp). Code that reads those exported JSON files must be updated. For example, `results[i].mean` is now `results[i].summary.time_wall_clock.mean`, and `results[i].times` is replaced by `results[i].measurements[j].time_wall_clock.value`. The new structure looks like this:22 23 ```python24 {25 "schema_version": 2,26 "primary_metric": "time_wall_clock",27 "metadata": {31- "hyperfine_version": "2.0.0-alpha.1",28+ "hyperfine_version": "2.0.0",29 "start_time": "2026-10-06T12:00:00Z",30 "platform": {"os": "Linux", "architecture": "x86_64"}31 },32 "results": [33 {34 "command": "sleep 1", # Actual command after parameter substitution38- "name": "wait 1s", # Optional custom name, separate from the command35+ "name": "wait 1s", # Optional custom or automatically generated name36 "parameters": {"duration": {"value": "1"}}, # Values are now objects37+ "environment": {"OMP_NUM_THREADS": "8"}, # Only present with --env overrides38 "measurements": [ # One entry per run, excluding warmups39 {40 "time_wall_clock": {"value": 1.0, "unit": "second"},41+ "time_cpu": {"value": 0.0, "unit": "second"},42 "time_user": {"value": 0.0, "unit": "second"},43 "time_system": {"value": 0.0, "unit": "second"},44 "memory_peak_resident": {"value": 1048576.0, "unit": "byte"},45+ "cpu_cycles": {"value": 5000000}, # Hardware counters, when available46+ "instructions": {"value": 10000000},47 "exit_code": 048 },49 ... # Further runs omitted50 ],13 unmodified lines64 ]65 }66 ```67 67- Times are always exported in seconds and memory in bytes.68+ Times are always exported in seconds and memory in bytes. Hardware counters and their summaries have no `unit` field. Unavailable memory measurements and hardware counters are omitted; other available counters may also be included. `stddev` is `null` for a single run.69 - `--time-unit`/`-u` has been removed. Units can now be selected using the `--metrics METRIC[:UNIT],…` option, e.g. `--metrics time_wall_clock:ms,memory_peak_resident:MiB`.70 - `--sort` has been removed. It complicated hyperfine significantly and doesn't make too much sense with the new output format.70-- `--reference` and `--reference-name` have been removed (for now). The first command is always considered as the reference command.71-- The format of Markdown, AsciiDoc, org-mode and CSV exports has also been changed. These formats contain only the primary metric (the first metric selected by `--metrics`). CSV now includes columns with the name and the unit of the primary metric.71+- `--reference` and `--reference-name` have been removed (for now). The first command is always considered as the reference command. Invocations using `--reference` now show migration guidance to put the reference command first.72+- The format of [Markdown](README.md#markdown), AsciiDoc and org-mode, and [CSV](README.md#csv) exports has also been changed. Markdown, AsciiDoc, and org-mode contain only the primary metric (the first metric selected by `--metrics`). CSV exports all selected metrics side by side.73 74 # v1.21.075 76 ## Features453 unmodified linesmodified:CITATION.cff+1 added-1 removed
11 unmodified lines12 orcid: 'https://orcid.org/0000-0001-7950-9915'13 repository-code: 'https://github.com/sharkdp/hyperfine'14 abstract: A command-line benchmarking tool.15 license: MIT16-version: 2.0.0-alpha.216+version: 2.0.017 date-released: '2026-10-07'modified:pyproject.toml+1 added-1 removed
1233456729 unmodified lines[project]name = "hyperfine-scripts"version = "0.1.0"version = "2.0.0"description = "Plot and analyze hyperfine JSON benchmark results"requires-python = ">=3.10"license-files = ["LICENSE-APACHE", "LICENSE-MIT"]dependencies = [29 unmodified linesmodified:README.md+2 added-2 removed
329 unmodified lines330 ```331 332 Alternatively, for the latest version, you can download the appropriate `.deb` package from the [Release page](https://github.com/sharkdp/hyperfine/releases) and install it via `dpkg`:333 ```334-wget https://github.com/sharkdp/hyperfine/releases/download/v1.21.0/hyperfine_1.21.0_amd64.deb335-sudo dpkg -i hyperfine_1.21.0_amd64.deb334+wget https://github.com/sharkdp/hyperfine/releases/download/v2.0.0/hyperfine_2.0.0_amd64.deb335+sudo dpkg -i hyperfine_2.0.0_amd64.deb336 ```337 338 ### On Fedora339 158 unmodified lines