mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-12-01 04:10:52 +00:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d3c7bb81e | ||
|
|
eb1a3212f7 | ||
|
|
72aa8b40fe | ||
|
|
74070e2357 | ||
|
|
7004997397 | ||
|
|
7ea8e9f215 |
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-24.04
|
runs-on: ubuntu-20.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-24.04
|
runs-on: ubuntu-20.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-24.04, use-cross: true }
|
- { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
|
||||||
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-24.04, use-cross: true }
|
- { target: aarch64-apple-darwin , os: macos-14 }
|
||||||
- { target: arm-unknown-linux-musleabihf, os: ubuntu-24.04, use-cross: true }
|
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true }
|
||||||
- { target: i686-pc-windows-msvc , os: windows-2022 }
|
- { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true }
|
||||||
- { target: i686-unknown-linux-gnu , os: ubuntu-24.04, use-cross: true }
|
- { target: i686-pc-windows-msvc , os: windows-2019 }
|
||||||
- { target: i686-unknown-linux-musl , os: ubuntu-24.04, use-cross: true }
|
- { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
|
||||||
- { target: x86_64-apple-darwin , os: macos-15 }
|
- { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
|
||||||
- { target: aarch64-apple-darwin , os: macos-15 }
|
- { target: x86_64-apple-darwin , os: macos-12 }
|
||||||
# - { target: x86_64-pc-windows-gnu , os: windows-2022 }
|
# - { target: x86_64-pc-windows-gnu , os: windows-2019 }
|
||||||
- { target: x86_64-pc-windows-msvc , os: windows-2022 }
|
- { target: x86_64-pc-windows-msvc , os: windows-2019 }
|
||||||
- { target: x86_64-unknown-linux-gnu , os: ubuntu-24.04, use-cross: true }
|
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
|
||||||
- { target: x86_64-unknown-linux-musl , os: ubuntu-24.04, use-cross: true }
|
- { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
|
||||||
env:
|
env:
|
||||||
BUILD_CMD: cargo
|
BUILD_CMD: cargo
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
Generated
+8
-8
@@ -73,9 +73,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.95"
|
version = "1.0.93"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
|
checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "approx"
|
name = "approx"
|
||||||
@@ -229,18 +229,18 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.23"
|
version = "4.5.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84"
|
checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.5.23"
|
version = "4.5.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838"
|
checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
@@ -260,9 +260,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_lex"
|
name = "clap_lex"
|
||||||
version = "0.7.4"
|
version = "0.7.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
|
checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cloudabi"
|
name = "cloudabi"
|
||||||
|
|||||||
+2
-2
@@ -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.88.0"
|
rust-version = "1.76.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# Use the nightly feature windows_process_extensions_main_thread_handle
|
# Use the nightly feature windows_process_extensions_main_thread_handle
|
||||||
@@ -72,7 +72,7 @@ insta.opt-level = 3
|
|||||||
similar.opt-level = 3
|
similar.opt-level = 3
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
clap = "4.5.23"
|
clap = "4.4.12"
|
||||||
clap_complete = "4.2.1"
|
clap_complete = "4.2.1"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|||||||
@@ -10,18 +10,6 @@ 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.
|
||||||
@@ -331,9 +319,6 @@ 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.
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
## 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.
|
Before Width: | Height: | Size: 130 KiB |
@@ -1,83 +0,0 @@
|
|||||||
#!/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()
|
|
||||||
@@ -3,12 +3,6 @@ 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");
|
||||||
@@ -312,7 +306,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(STDIN_READ_COMMAND)
|
.arg("cat")
|
||||||
.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"));
|
||||||
@@ -324,7 +318,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(STDIN_READ_COMMAND)
|
.arg("cat")
|
||||||
.assert()
|
.assert()
|
||||||
.failure()
|
.failure()
|
||||||
.stderr(predicate::str::contains(
|
.stderr(predicate::str::contains(
|
||||||
|
|||||||
Reference in new issue
Block a user