mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-12-01 12:20:59 +00:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34aed32655 | ||
|
|
4b561defef | ||
|
|
27a079e0df | ||
|
|
148632c5f9 | ||
|
|
09f02e4f59 | ||
|
|
c30ac680a3 |
No files matched your search
+2
-2
@@ -13,5 +13,5 @@ authors:
|
|||||||
repository-code: 'https://github.com/sharkdp/hyperfine'
|
repository-code: 'https://github.com/sharkdp/hyperfine'
|
||||||
abstract: A command-line benchmarking tool.
|
abstract: A command-line benchmarking tool.
|
||||||
license: MIT
|
license: MIT
|
||||||
version: 1.16.1
|
version: 1.20.0
|
||||||
date-released: '2023-03-21'
|
date-released: '2025-11-18'
|
||||||
Generated
+295
-464
File diff suppressed because it is too large.
Load diff
+15
-14
@@ -10,22 +10,23 @@ repository = "https://github.com/sharkdp/hyperfine"
|
|||||||
version = "1.20.0"
|
version = "1.20.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
rust-version = "1.88.0"
|
rust-version = "1.97.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# Use the nightly feature windows_process_extensions_main_thread_handle
|
# Use the nightly feature windows_process_extensions_main_thread_handle
|
||||||
windows_process_extensions_main_thread_handle = []
|
windows_process_extensions_main_thread_handle = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
colored = "2.1"
|
colored = "3.1"
|
||||||
|
# Newer versions regress ETA estimates: https://github.com/console-rs/indicatif/issues/580
|
||||||
indicatif = "=0.17.4"
|
indicatif = "=0.17.4"
|
||||||
statistical = "1.0"
|
statistical = "1.0"
|
||||||
csv = "1.3"
|
csv = "1.4"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
rust_decimal = "1.36"
|
rust_decimal = "1.43"
|
||||||
rand = "0.8"
|
rand = "0.10"
|
||||||
shell-words = "1.0"
|
shell-words = "1.1"
|
||||||
thiserror = "2.0"
|
thiserror = "2.0"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ anyhow = "1.0"
|
|||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
windows-sys = { version = "0.59", features = [
|
windows-sys = { version = "0.61", features = [
|
||||||
"Win32_Foundation",
|
"Win32_Foundation",
|
||||||
"Win32_Security",
|
"Win32_Security",
|
||||||
"Win32_System_JobObjects",
|
"Win32_System_JobObjects",
|
||||||
@@ -42,10 +43,10 @@ windows-sys = { version = "0.59", features = [
|
|||||||
] }
|
] }
|
||||||
|
|
||||||
[target.'cfg(all(windows, not(windows_process_extensions_main_thread_handle)))'.dependencies]
|
[target.'cfg(all(windows, not(windows_process_extensions_main_thread_handle)))'.dependencies]
|
||||||
once_cell = "1.19"
|
once_cell = "1.21"
|
||||||
|
|
||||||
[target.'cfg(target_os="linux")'.dependencies]
|
[target.'cfg(target_os="linux")'.dependencies]
|
||||||
nix = { version = "0.29", features = ["zerocopy"] }
|
nix = { version = "0.31", features = ["zerocopy"] }
|
||||||
|
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
version = "4"
|
version = "4"
|
||||||
@@ -62,18 +63,18 @@ features = [
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
approx = "0.5"
|
approx = "0.5"
|
||||||
assert_cmd = "2.0"
|
assert_cmd = "2.2"
|
||||||
insta = { version = "1.41.1", features = ["yaml"] }
|
insta = { version = "1.48", features = ["yaml"] }
|
||||||
predicates = "3.1"
|
predicates = "3.1"
|
||||||
tempfile = "3.23"
|
tempfile = "3.27"
|
||||||
|
|
||||||
[profile.dev.package]
|
[profile.dev.package]
|
||||||
insta.opt-level = 3
|
insta.opt-level = 3
|
||||||
similar.opt-level = 3
|
similar.opt-level = 3
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
clap = "4.5.48"
|
clap = "4.6"
|
||||||
clap_complete = "4.2.1"
|
clap_complete = "4.6"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ hyperfine -N 'grep TODO /home/user'
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Shell functions and aliases
|
### Shell functions
|
||||||
|
|
||||||
If you are using bash, you can export shell functions to directly benchmark them with hyperfine:
|
If you are using bash, you can export shell functions to directly benchmark them with hyperfine:
|
||||||
|
|
||||||
@@ -118,13 +118,10 @@ export -f my_function
|
|||||||
hyperfine --shell=bash my_function
|
hyperfine --shell=bash my_function
|
||||||
```
|
```
|
||||||
|
|
||||||
Otherwise, inline them into or source them from the benchmarked program:
|
Otherwise, inline the function into the benchmarked command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
hyperfine 'my_function() { sleep 1; }; my_function'
|
hyperfine 'my_function() { sleep 1; }; my_function'
|
||||||
|
|
||||||
echo 'alias my_alias="sleep 1"' > /tmp/my_alias.sh
|
|
||||||
hyperfine '. /tmp/my_alias.sh; my_alias'
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Exporting results
|
### Exporting results
|
||||||
@@ -305,7 +302,7 @@ Hyperfine can be installed from source via [cargo](https://doc.rust-lang.org/car
|
|||||||
cargo install --locked hyperfine
|
cargo install --locked hyperfine
|
||||||
```
|
```
|
||||||
|
|
||||||
Make sure that you use Rust 1.76 or newer.
|
Make sure that you use Rust 1.97 or newer.
|
||||||
|
|
||||||
### From binaries (Linux, macOS, Windows)
|
### From binaries (Linux, macOS, Windows)
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ impl<'a> Scheduler<'a> {
|
|||||||
println!(
|
println!(
|
||||||
"{} {}",
|
"{} {}",
|
||||||
comparator,
|
comparator,
|
||||||
&item.result.command_with_unused_parameters.magenta()
|
item.result.command_with_unused_parameters.magenta()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ impl<'a> Scheduler<'a> {
|
|||||||
} else {
|
} else {
|
||||||
" ".into()
|
" ".into()
|
||||||
},
|
},
|
||||||
&item.result.command_with_unused_parameters,
|
item.result.command_with_unused_parameters,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -158,7 +158,9 @@ impl<'a> Commands<'a> {
|
|||||||
});
|
});
|
||||||
let args: Vec<_> = args.map(|v| v.as_str()).collect::<Vec<_>>();
|
let args: Vec<_> = args.map(|v| v.as_str()).collect::<Vec<_>>();
|
||||||
let param_names_and_values: Vec<(&str, Vec<String>)> = args
|
let param_names_and_values: Vec<(&str, Vec<String>)> = args
|
||||||
.chunks_exact(2)
|
.as_chunks::<2>()
|
||||||
|
.0
|
||||||
|
.iter()
|
||||||
.map(|pair| {
|
.map(|pair| {
|
||||||
let name = pair[0];
|
let name = pair[0];
|
||||||
let list_str = pair[1];
|
let list_str = pair[1];
|
||||||
@@ -169,7 +171,7 @@ impl<'a> Commands<'a> {
|
|||||||
let duplicates =
|
let duplicates =
|
||||||
Self::find_duplicates(param_names_and_values.iter().map(|(name, _)| *name));
|
Self::find_duplicates(param_names_and_values.iter().map(|(name, _)| *name));
|
||||||
if !duplicates.is_empty() {
|
if !duplicates.is_empty() {
|
||||||
bail!("Duplicate parameter names: {}", &duplicates.join(", "));
|
bail!("Duplicate parameter names: {}", duplicates.join(", "));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ impl MarkupExporter for OrgmodeExporter {
|
|||||||
format!(
|
format!(
|
||||||
"| {} | {} |\n",
|
"| {} | {} |\n",
|
||||||
cells.first().unwrap(),
|
cells.first().unwrap(),
|
||||||
&cells[1..].join(" | ")
|
cells[1..].join(" | ")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
/// [1] Mytkowicz, 2009. Producing Wrong Data Without Doing Anything Obviously Wrong!.
|
/// [1] Mytkowicz, 2009. Producing Wrong Data Without Doing Anything Obviously Wrong!.
|
||||||
/// Sigplan Notices - SIGPLAN. 44. 265-276. 10.1145/1508284.1508275.
|
/// Sigplan Notices - SIGPLAN. 44. 265-276. 10.1145/1508284.1508275.
|
||||||
pub fn value() -> String {
|
pub fn value() -> String {
|
||||||
"X".repeat(rand::random::<usize>() % 4096usize)
|
"X".repeat(rand::random_range(0..4096))
|
||||||
}
|
}
|
||||||
+1
-3
@@ -1,9 +1,7 @@
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
use assert_cmd::cargo::CommandCargoExt;
|
|
||||||
|
|
||||||
pub fn hyperfine_raw_command() -> Command {
|
pub fn hyperfine_raw_command() -> Command {
|
||||||
let mut cmd = Command::cargo_bin("hyperfine").unwrap();
|
let mut cmd = Command::new(assert_cmd::cargo::cargo_bin!("hyperfine"));
|
||||||
cmd.current_dir("tests/");
|
cmd.current_dir("tests/");
|
||||||
cmd
|
cmd
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user