mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-30 20:00:55 +00:00
Compare commits
19
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6abc025bc | ||
|
|
5e32684411 | ||
|
|
c6fd0395b9 | ||
|
|
f8db978653 | ||
|
|
648819a1ad | ||
|
|
3cedcc38d0 | ||
|
|
ee4e4d04b2 | ||
|
|
92cc4f2d79 | ||
|
|
3b0918511a | ||
|
|
3bd38f275e | ||
|
|
f6794c313c | ||
|
|
efe3b53767 | ||
|
|
582f2ed960 | ||
|
|
ebcf794d97 | ||
|
|
038f369420 | ||
|
|
0705d6c7d0 | ||
|
|
0d2e3a4dd7 | ||
|
|
da399ab654 | ||
|
|
7a9d04d35c |
No files matched your search
+14
-14
@@ -44,7 +44,7 @@ jobs:
|
|||||||
|
|
||||||
ensure_cargo_fmt:
|
ensure_cargo_fmt:
|
||||||
name: Ensure 'cargo fmt' has been run
|
name: Ensure 'cargo fmt' has been run
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
@@ -54,7 +54,7 @@ jobs:
|
|||||||
|
|
||||||
min_version:
|
min_version:
|
||||||
name: Minimum supported rust version
|
name: Minimum supported rust version
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-24.04
|
||||||
needs: crate_metadata
|
needs: crate_metadata
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source code
|
- name: Checkout source code
|
||||||
@@ -78,18 +78,18 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
job:
|
job:
|
||||||
- { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
|
- { target: aarch64-unknown-linux-gnu , os: ubuntu-24.04, use-cross: true }
|
||||||
- { target: aarch64-apple-darwin , os: macos-14 }
|
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-24.04, use-cross: true }
|
||||||
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true }
|
- { target: arm-unknown-linux-musleabihf, os: ubuntu-24.04, use-cross: true }
|
||||||
- { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true }
|
- { target: i686-pc-windows-msvc , os: windows-2022 }
|
||||||
- { target: i686-pc-windows-msvc , os: windows-2019 }
|
- { target: i686-unknown-linux-gnu , os: ubuntu-24.04, use-cross: true }
|
||||||
- { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
|
- { target: i686-unknown-linux-musl , os: ubuntu-24.04, use-cross: true }
|
||||||
- { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
|
- { target: x86_64-apple-darwin , os: macos-15 }
|
||||||
- { target: x86_64-apple-darwin , os: macos-12 }
|
- { target: aarch64-apple-darwin , os: macos-15 }
|
||||||
# - { target: x86_64-pc-windows-gnu , os: windows-2019 }
|
# - { target: x86_64-pc-windows-gnu , os: windows-2022 }
|
||||||
- { target: x86_64-pc-windows-msvc , os: windows-2019 }
|
- { target: x86_64-pc-windows-msvc , os: windows-2022 }
|
||||||
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
|
- { target: x86_64-unknown-linux-gnu , os: ubuntu-24.04, use-cross: true }
|
||||||
- { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
|
- { target: x86_64-unknown-linux-musl , os: ubuntu-24.04, use-cross: true }
|
||||||
env:
|
env:
|
||||||
BUILD_CMD: cargo
|
BUILD_CMD: cargo
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
Generated
+13
-13
@@ -1,6 +1,6 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ahash"
|
name = "ahash"
|
||||||
@@ -73,9 +73,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.93"
|
version = "1.0.95"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775"
|
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "approx"
|
name = "approx"
|
||||||
@@ -229,18 +229,18 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.20"
|
version = "4.5.47"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8"
|
checksum = "7eac00902d9d136acd712710d71823fb8ac8004ca445a89e73a41d45aa712931"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.5.20"
|
version = "4.5.47"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54"
|
checksum = "2ad9bbf750e73b5884fb8a211a9424a1906c1e156724260fdae972f31d70e1d6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
@@ -260,9 +260,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_lex"
|
name = "clap_lex"
|
||||||
version = "0.7.2"
|
version = "0.7.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
|
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cloudabi"
|
name = "cloudabi"
|
||||||
@@ -365,9 +365,9 @@ checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "float-cmp"
|
name = "float-cmp"
|
||||||
version = "0.9.0"
|
version = "0.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
|
checksum = "b09cf3155332e944990140d967ff5eceb70df778b34f77d8075db46e4704e6d8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
@@ -648,9 +648,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "predicates"
|
name = "predicates"
|
||||||
version = "3.1.2"
|
version = "3.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97"
|
checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"difflib",
|
"difflib",
|
||||||
|
|||||||
+3
-3
@@ -10,7 +10,7 @@ repository = "https://github.com/sharkdp/hyperfine"
|
|||||||
version = "1.19.0"
|
version = "1.19.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
rust-version = "1.76.0"
|
rust-version = "1.88.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# Use the nightly feature windows_process_extensions_main_thread_handle
|
# Use the nightly feature windows_process_extensions_main_thread_handle
|
||||||
@@ -64,7 +64,7 @@ features = [
|
|||||||
approx = "0.5"
|
approx = "0.5"
|
||||||
assert_cmd = "2.0"
|
assert_cmd = "2.0"
|
||||||
insta = { version = "1.41.1", features = ["yaml"] }
|
insta = { version = "1.41.1", features = ["yaml"] }
|
||||||
predicates = "3.0"
|
predicates = "3.1"
|
||||||
tempfile = "3.14"
|
tempfile = "3.14"
|
||||||
|
|
||||||
[profile.dev.package]
|
[profile.dev.package]
|
||||||
@@ -72,7 +72,7 @@ insta.opt-level = 3
|
|||||||
similar.opt-level = 3
|
similar.opt-level = 3
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
clap = "4.4.12"
|
clap = "4.5.47"
|
||||||
clap_complete = "4.2.1"
|
clap_complete = "4.2.1"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|||||||
@@ -10,6 +10,18 @@ A command-line benchmarking tool.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
### Sponsors
|
||||||
|
|
||||||
|
A special *thank you* goes to our biggest <a href="doc/sponsors.md">sponsor</a>:<br>
|
||||||
|
|
||||||
|
<a href="https://www.warp.dev/hyperfine">
|
||||||
|
<img src="doc/sponsors/warp-logo.png" width="200" alt="Warp">
|
||||||
|
<br>
|
||||||
|
<strong>Warp, the intelligent terminal</strong>
|
||||||
|
<br>
|
||||||
|
<sub>Available on MacOS, Linux, Windows</sub>
|
||||||
|
</a>
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Statistical analysis across multiple runs.
|
* Statistical analysis across multiple runs.
|
||||||
@@ -319,6 +331,9 @@ visualize changes in benchmark timings across your Git history.
|
|||||||
[Bencher](https://github.com/bencherdev/bencher) is a continuous benchmarking tool that supports `hyperfine` to
|
[Bencher](https://github.com/bencherdev/bencher) is a continuous benchmarking tool that supports `hyperfine` to
|
||||||
track benchmarks and catch performance regressions in CI.
|
track benchmarks and catch performance regressions in CI.
|
||||||
|
|
||||||
|
Drop hyperfine JSON outputs onto the [Venz](https://try.venz.dev) chart to visualize the results,
|
||||||
|
and manage hyperfine configurations.
|
||||||
|
|
||||||
Make sure to check out the [`scripts` folder](https://github.com/sharkdp/hyperfine/tree/master/scripts)
|
Make sure to check out the [`scripts` folder](https://github.com/sharkdp/hyperfine/tree/master/scripts)
|
||||||
in this repository for a set of tools to work with `hyperfine` benchmark results.
|
in this repository for a set of tools to work with `hyperfine` benchmark results.
|
||||||
|
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ The \fB\-\-prepare\fR option can be specified once for all commands or multiple
|
|||||||
once for each command. In the latter case, each preparation command will be
|
once for each command. In the latter case, each preparation command will be
|
||||||
run prior to the corresponding benchmark command.
|
run prior to the corresponding benchmark command.
|
||||||
.HP
|
.HP
|
||||||
|
\fB\-\-conclude\fR \fICMD...\fP
|
||||||
.IP
|
.IP
|
||||||
Execute \fICMD\fP after each timing run. This is useful for clearing disk caches,
|
Execute \fICMD\fP after each timing run. This is useful for clearing disk caches,
|
||||||
for example.
|
for example.
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
## Sponsors
|
||||||
|
|
||||||
|
`hyperfine` development is sponsored by many individuals and companies. Thank you very much!
|
||||||
|
|
||||||
|
Please note, that being sponsored does not affect the individuality of the `hyperfine`
|
||||||
|
project or affect the maintainers' actions in any way.
|
||||||
|
We remain impartial and continue to assess pull requests solely on merit - the
|
||||||
|
features added, bugs solved, and effect on the overall complexity of the code.
|
||||||
|
No issue will have a different priority based on sponsorship status of the
|
||||||
|
reporter.
|
||||||
|
|
||||||
|
Contributions from anybody are most welcomed.
|
||||||
|
|
||||||
|
If you want to see our biggest sponsors, check the top of [`README.md`](../README.md#sponsors).
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 130 KiB |
Executable
+83
@@ -0,0 +1,83 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# /// script
|
||||||
|
# requires-python = ">=3.10"
|
||||||
|
# dependencies = [
|
||||||
|
# "matplotlib",
|
||||||
|
# "pyqt6",
|
||||||
|
# "numpy",
|
||||||
|
# ]
|
||||||
|
# ///
|
||||||
|
|
||||||
|
"""
|
||||||
|
This script shows `hyperfine` benchmark results as a bar plot grouped by command.
|
||||||
|
Note all the input files must contain results for all commands.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
parser.add_argument(
|
||||||
|
"files", nargs="+", type=pathlib.Path, help="JSON files with benchmark results"
|
||||||
|
)
|
||||||
|
parser.add_argument("--title", help="Plot Title")
|
||||||
|
parser.add_argument(
|
||||||
|
"--benchmark-names", nargs="+", help="Names of the benchmark groups"
|
||||||
|
)
|
||||||
|
parser.add_argument("-o", "--output", help="Save image to the given filename")
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
commands = None
|
||||||
|
data = []
|
||||||
|
inputs = []
|
||||||
|
|
||||||
|
if args.benchmark_names:
|
||||||
|
assert len(args.files) == len(
|
||||||
|
args.benchmark_names
|
||||||
|
), "Number of benchmark names must match the number of input files."
|
||||||
|
|
||||||
|
for i, filename in enumerate(args.files):
|
||||||
|
with open(filename) as f:
|
||||||
|
results = json.load(f)["results"]
|
||||||
|
benchmark_commands = [b["command"] for b in results]
|
||||||
|
if commands is None:
|
||||||
|
commands = benchmark_commands
|
||||||
|
else:
|
||||||
|
assert (
|
||||||
|
commands == benchmark_commands
|
||||||
|
), f"Unexpected commands in {filename}: {benchmark_commands}, expected: {commands}"
|
||||||
|
data.append([round(b["mean"], 2) for b in results])
|
||||||
|
if args.benchmark_names:
|
||||||
|
inputs.append(args.benchmark_names[i])
|
||||||
|
else:
|
||||||
|
inputs.append(filename.stem)
|
||||||
|
|
||||||
|
data = np.transpose(data)
|
||||||
|
x = np.arange(len(inputs)) # the label locations
|
||||||
|
width = 0.25 # the width of the bars
|
||||||
|
|
||||||
|
fig, ax = plt.subplots(layout="constrained")
|
||||||
|
fig.set_figheight(5)
|
||||||
|
fig.set_figwidth(10)
|
||||||
|
for i, command in enumerate(commands):
|
||||||
|
offset = width * (i + 1)
|
||||||
|
rects = ax.bar(x + offset, data[i], width, label=command)
|
||||||
|
|
||||||
|
ax.set_xticks(x + 0.5, inputs)
|
||||||
|
ax.grid(visible=True, axis="y")
|
||||||
|
|
||||||
|
if args.title:
|
||||||
|
plt.title(args.title)
|
||||||
|
plt.xlabel("Benchmark")
|
||||||
|
plt.ylabel("Time [s]")
|
||||||
|
plt.legend(title="Command")
|
||||||
|
|
||||||
|
if args.output:
|
||||||
|
plt.savefig(args.output)
|
||||||
|
else:
|
||||||
|
plt.show()
|
||||||
@@ -98,7 +98,7 @@ pub fn compute_with_check_from_reference<'a>(
|
|||||||
pub fn compute_with_check(
|
pub fn compute_with_check(
|
||||||
results: &[BenchmarkResult],
|
results: &[BenchmarkResult],
|
||||||
sort_order: SortOrder,
|
sort_order: SortOrder,
|
||||||
) -> Option<Vec<BenchmarkResultWithRelativeSpeed>> {
|
) -> Option<Vec<BenchmarkResultWithRelativeSpeed<'_>>> {
|
||||||
let fastest = fastest_of(results);
|
let fastest = fastest_of(results);
|
||||||
|
|
||||||
if fastest.mean == 0.0 {
|
if fastest.mean == 0.0 {
|
||||||
@@ -112,7 +112,7 @@ pub fn compute_with_check(
|
|||||||
pub fn compute(
|
pub fn compute(
|
||||||
results: &[BenchmarkResult],
|
results: &[BenchmarkResult],
|
||||||
sort_order: SortOrder,
|
sort_order: SortOrder,
|
||||||
) -> Vec<BenchmarkResultWithRelativeSpeed> {
|
) -> Vec<BenchmarkResultWithRelativeSpeed<'_>> {
|
||||||
let fastest = fastest_of(results);
|
let fastest = fastest_of(results);
|
||||||
|
|
||||||
compute_relative_speeds(results, fastest, sort_order)
|
compute_relative_speeds(results, fastest, sort_order)
|
||||||
|
|||||||
@@ -3,6 +3,12 @@ use common::hyperfine;
|
|||||||
|
|
||||||
use predicates::prelude::*;
|
use predicates::prelude::*;
|
||||||
|
|
||||||
|
/// Platform-specific I/O utility.
|
||||||
|
/// - On Unix-like systems, defaults to `cat`.
|
||||||
|
/// - On Windows, uses `findstr` as an alternative.
|
||||||
|
/// See: <https://superuser.com/questions/853580/real-windows-equivalent-to-cat-stdin>
|
||||||
|
const STDIN_READ_COMMAND: &str = if cfg!(windows) { "findstr x*" } else { "cat" };
|
||||||
|
|
||||||
pub fn hyperfine_debug() -> assert_cmd::Command {
|
pub fn hyperfine_debug() -> assert_cmd::Command {
|
||||||
let mut cmd = hyperfine();
|
let mut cmd = hyperfine();
|
||||||
cmd.arg("--debug-mode");
|
cmd.arg("--debug-mode");
|
||||||
@@ -306,7 +312,7 @@ fn can_pass_input_to_command_from_a_file() {
|
|||||||
.arg("--runs=1")
|
.arg("--runs=1")
|
||||||
.arg("--input=example_input_file.txt")
|
.arg("--input=example_input_file.txt")
|
||||||
.arg("--show-output")
|
.arg("--show-output")
|
||||||
.arg("cat")
|
.arg(STDIN_READ_COMMAND)
|
||||||
.assert()
|
.assert()
|
||||||
.success()
|
.success()
|
||||||
.stdout(predicate::str::contains("This text is part of a file"));
|
.stdout(predicate::str::contains("This text is part of a file"));
|
||||||
@@ -318,7 +324,7 @@ fn fails_if_invalid_stdin_data_file_provided() {
|
|||||||
.arg("--runs=1")
|
.arg("--runs=1")
|
||||||
.arg("--input=example_non_existent_file.txt")
|
.arg("--input=example_non_existent_file.txt")
|
||||||
.arg("--show-output")
|
.arg("--show-output")
|
||||||
.arg("cat")
|
.arg(STDIN_READ_COMMAND)
|
||||||
.assert()
|
.assert()
|
||||||
.failure()
|
.failure()
|
||||||
.stderr(predicate::str::contains(
|
.stderr(predicate::str::contains(
|
||||||
|
|||||||
Reference in new issue
Block a user