mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Make plotting scripts runnable with uv
This commit is contained in:
1 parent
4a9e066b41
commit
ce49529780
10 files changed
+526
-434
No files matched your search
+23
-13
@@ -1,23 +1,33 @@
|
||||
This folder contains scripts that can be used in combination with hyperfine's `--export-json` option.
|
||||
|
||||
### Example:
|
||||
### Run directly from GitHub
|
||||
|
||||
Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/), then
|
||||
run one of the scripts:
|
||||
|
||||
```bash
|
||||
hyperfine 'sleep 0.020' 'sleep 0.021' 'sleep 0.022' --export-json sleep.json
|
||||
uv run plot_whisker.py sleep.json
|
||||
uvx --from 'git+https://github.com/sharkdp/hyperfine' \
|
||||
plot_whisker sleep.json
|
||||
```
|
||||
|
||||
All plotting and analysis scripts use the JSON export's `primary_metric` by default.
|
||||
Replace `plot_whisker` with any of the following commands.
|
||||
|
||||
| Command | Description |
|
||||
| --- | --- |
|
||||
| `plot_whisker` | Compare benchmarks with a box and whisker plot |
|
||||
| `plot_histogram` | Show the distribution of measurements |
|
||||
| `plot_parametrized` | Plot results from a parameter scan |
|
||||
| `plot_progression` | Show measurements in run order |
|
||||
| `plot_benchmark_comparison` | Compare commands across multiple JSON exports |
|
||||
| `advanced_statistics` | Print additional statistics and percentiles |
|
||||
| `welch_ttest` | Compare two benchmarks using Welch's t-test |
|
||||
|
||||
By default, the plotting and analysis scripts use the metric that was selected
|
||||
first in the actual hyperfine run (`--metrics` option).
|
||||
Use `--metric` to select another metric:
|
||||
|
||||
```bash
|
||||
uv run plot_histogram.py benchmark.json --metric instructions
|
||||
uvx --from 'git+https://github.com/sharkdp/hyperfine' \
|
||||
plot_histogram benchmark.json --metric instructions
|
||||
```
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) and run the
|
||||
commands above from this directory.
|
||||
|
||||
The scripts declare their dependencies using [PEP 723](https://peps.python.org/pep-0723/)
|
||||
inline script metadata. `uv run` automatically installs these dependencies in an
|
||||
isolated environment before running the script.
|
||||
Reference in new issue
Block a user