Skip to content
Myr

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

6 files+28 added−27 removed

modified:Cargo.lock+1 added-1 removed
375 unmodified lines
376checksum = "15cdd26707701c53297e2fa6afb323d55fbc1d0810c3aec078ae3ef0424c3c15"377378[[package]]379name = "hyperfine"380version = "2.0.0-alpha.2"380version = "2.0.0"381dependencies = [382 "anyhow",383 "approx",384 "assert_cmd",
827 unmodified lines
modified:Cargo.toml+1 added-1 removed
modified:CHANGELOG.md+22 added-21 removed
1# v2.0.0-alpha.21# v2.0.023## Changes3See the breaking changes below when migrating from hyperfine 1.x.45- 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## Features610# 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:912This 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 ```1414## Features15- The plotting and analysis scripts now support different metrics as well, see #981 and #984 (@sharkdp).1616- 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).2017## Breaking changes1823- 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:2223 ```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 lines
64 ]65 }66 ```6767 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.7374# v1.21.07576## Features
453 unmodified lines
modified:CITATION.cff+1 added-1 removed
11 unmodified lines
12 orcid: 'https://orcid.org/0000-0001-7950-9915'13repository-code: 'https://github.com/sharkdp/hyperfine'14abstract: A command-line benchmarking tool.15license: MIT16version: 2.0.0-alpha.216version: 2.0.017date-released: '2026-10-07'
modified:pyproject.toml+1 added-1 removed
modified:README.md+2 added-2 removed
329 unmodified lines
330```331332Alternatively, 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```334wget https://github.com/sharkdp/hyperfine/releases/download/v1.21.0/hyperfine_1.21.0_amd64.deb335sudo dpkg -i hyperfine_1.21.0_amd64.deb334wget https://github.com/sharkdp/hyperfine/releases/download/v2.0.0/hyperfine_2.0.0_amd64.deb335sudo dpkg -i hyperfine_2.0.0_amd64.deb336```337338### On Fedora339
158 unmodified lines