mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-20 11:21:39 +00:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
272183efd1 | ||
|
|
5d501b62f9 | ||
|
|
8745487c60 | ||
|
|
0f2871bd66 | ||
|
|
ce704016f9 | ||
|
|
f39b497bdd | ||
|
|
79aea8872a | ||
|
|
f48f44b336 | ||
|
|
ebb3182a6e |
No files matched your search
@@ -1,3 +1,35 @@
|
||||
# v1.21.0
|
||||
|
||||
## Features
|
||||
|
||||
- Add support for minutes and hours in `--time-unit`, as well as short and plural aliases such as `ms`, `seconds`, and `min`, see #960 (@sharkdp)
|
||||
- Expose `$HYPERFINE_ITERATION` to `--prepare` and `--conclude` commands, see #781 and #807 (@willcl-ark)
|
||||
- Show elapsed time during the initial benchmark run, see #416 and #581 (@devonhollowood)
|
||||
- Add colors to `--help` output, see #841 (@starsep)
|
||||
|
||||
## Changes
|
||||
|
||||
- Format times in CSV exports with six decimal places, see #966 and #972 (@sharkdp)
|
||||
- Update dependencies and raise the minimum supported Rust version to 1.97, see #934 (@sharkdp)
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Reject zero values for `--runs`, `--min-runs`, and `--max-runs` instead of allowing invalid run counts, see #923 (@VXNCXNX, @sharkdp)
|
||||
- Reject negative parameter-scan steps before expanding ranges, avoiding hangs and excessive memory use, see #951 (@Likio3000)
|
||||
- Preserve existing export files when command options are invalid, see #950 (@Likio3000)
|
||||
- Truncate export files when rewriting results to avoid leaving trailing bytes, see #970 (@sharkdp)
|
||||
- Preserve backticks in command names in Markdown exports, see #947 (@Likio3000)
|
||||
- Handle broken output pipes gracefully instead of panicking, see #932 (@Mathjk)
|
||||
- Collect peak memory usage separately for each command on Unix, so commands no longer inherit the peak memory usage of earlier commands, see #965 (@sharkdp)
|
||||
- Preserve 100-nanosecond precision in Windows CPU times, see #964 (@sharkdp)
|
||||
- Python scripts: Correct the interpretation of Welch's t-test results, see #943 (@sharkdp)
|
||||
|
||||
## Other
|
||||
|
||||
- Build binaries for Windows ARM64 and Linux ARM64 musl, see #922 and #924 (@meop)
|
||||
- Refactor measurement, statistics, and formatting code to use typed quantities, see #954, #958, #961, #967, #969, #971, and #976 (@sharkdp)
|
||||
- Improve documentation and examples, including comparisons across Git branches, iteration variables, reference commands, and selective failure handling, see #899, #900, #929, and #940 (@xfocus3, @ded-furby, @Likio3000, @sharkdp)
|
||||
|
||||
# v1.20.0
|
||||
|
||||
## Features
|
||||
|
||||
+2
-2
@@ -13,5 +13,5 @@ authors:
|
||||
repository-code: 'https://github.com/sharkdp/hyperfine'
|
||||
abstract: A command-line benchmarking tool.
|
||||
license: MIT
|
||||
version: 1.20.0
|
||||
date-released: '2025-11-18'
|
||||
version: 1.21.0
|
||||
date-released: '2026-10-05'
|
||||
Generated
+1
-1
@@ -371,7 +371,7 @@ checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
||||
|
||||
[[package]]
|
||||
name = "hyperfine"
|
||||
version = "1.20.0"
|
||||
version = "1.21.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"approx",
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
|
||||
name = "hyperfine"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/sharkdp/hyperfine"
|
||||
version = "1.20.0"
|
||||
version = "1.21.0"
|
||||
edition = "2018"
|
||||
build = "build.rs"
|
||||
rust-version = "1.97.0"
|
||||
|
||||
@@ -188,8 +188,8 @@ apt install hyperfine
|
||||
|
||||
Alternatively, 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`:
|
||||
```
|
||||
wget https://github.com/sharkdp/hyperfine/releases/download/v1.20.0/hyperfine_1.20.0_amd64.deb
|
||||
sudo dpkg -i hyperfine_1.20.0_amd64.deb
|
||||
wget https://github.com/sharkdp/hyperfine/releases/download/v1.21.0/hyperfine_1.21.0_amd64.deb
|
||||
sudo dpkg -i hyperfine_1.21.0_amd64.deb
|
||||
```
|
||||
|
||||
### On Fedora
|
||||
|
||||
+28
-7
@@ -6,6 +6,7 @@ pub mod scheduler;
|
||||
|
||||
use std::cmp;
|
||||
use std::io::{self, Write};
|
||||
use std::time::Instant;
|
||||
|
||||
use crate::benchmark::executor::BenchmarkIteration;
|
||||
use crate::command::Command;
|
||||
@@ -14,7 +15,9 @@ use crate::options::{
|
||||
};
|
||||
use crate::outlier_detection::OUTLIER_THRESHOLD;
|
||||
use crate::output::console_writeln;
|
||||
use crate::output::progress_bar::get_progress_bar;
|
||||
use crate::output::progress_bar::{
|
||||
finish_initial_measurement, get_progress_bar, start_initial_measurement,
|
||||
};
|
||||
use crate::output::warnings::{OutlierWarningOptions, Warnings};
|
||||
use crate::parameter::ParameterNameAndValue;
|
||||
use crate::quantity::{const_time_from_seconds, ratio, FormatQuantity, Time, Zero};
|
||||
@@ -244,7 +247,11 @@ impl<'a> Benchmark<'a> {
|
||||
let progress_bar = if self.options.output_style != OutputStyleOption::Disabled {
|
||||
Some(get_progress_bar(
|
||||
self.options.run_bounds.min,
|
||||
"Initial time measurement",
|
||||
if preparation_command.is_some() {
|
||||
"Running preparation command"
|
||||
} else {
|
||||
"Initial run"
|
||||
},
|
||||
self.options.output_style,
|
||||
))
|
||||
} else {
|
||||
@@ -258,6 +265,9 @@ impl<'a> Benchmark<'a> {
|
||||
});
|
||||
|
||||
// Initial timing run
|
||||
if let Some(bar) = progress_bar.as_ref() {
|
||||
start_initial_measurement(bar, Instant::now());
|
||||
}
|
||||
let res = self.executor.run_command_and_measure(
|
||||
self.command,
|
||||
benchmark_iteration,
|
||||
@@ -266,6 +276,18 @@ impl<'a> Benchmark<'a> {
|
||||
)?;
|
||||
let success = res.exit_status.success();
|
||||
|
||||
if let Some(bar) = progress_bar.as_ref() {
|
||||
let time_unit = self
|
||||
.options
|
||||
.time_unit
|
||||
.unwrap_or(res.time_wall_clock.suitable_unit());
|
||||
let estimate = res.time_wall_clock.format(time_unit);
|
||||
finish_initial_measurement(
|
||||
bar,
|
||||
format!("Current estimate: {}", estimate.to_string().green()),
|
||||
);
|
||||
}
|
||||
|
||||
let conclusion_result = run_conclusion_command(benchmark_iteration)?;
|
||||
let conclusion_overhead = conclusion_result.map_or(Time::zero(), |res| {
|
||||
res.time_wall_clock + self.executor.time_overhead()
|
||||
@@ -299,16 +321,13 @@ impl<'a> Benchmark<'a> {
|
||||
|
||||
// Re-configure the progress bar
|
||||
if let Some(bar) = progress_bar.as_ref() {
|
||||
bar.set_length(count)
|
||||
}
|
||||
if let Some(bar) = progress_bar.as_ref() {
|
||||
bar.inc(1)
|
||||
bar.set_length(count);
|
||||
bar.inc(1);
|
||||
}
|
||||
|
||||
// Gather statistics (perform the actual benchmark)
|
||||
for i in 0..count_remaining {
|
||||
let benchmark_iteration = BenchmarkIteration::Benchmark(i + 1);
|
||||
run_preparation_command(benchmark_iteration)?;
|
||||
|
||||
let msg = {
|
||||
let t_wall_clock_mean = measurements.time_wall_clock_mean();
|
||||
@@ -324,6 +343,8 @@ impl<'a> Benchmark<'a> {
|
||||
bar.set_message(msg.to_owned())
|
||||
}
|
||||
|
||||
run_preparation_command(benchmark_iteration)?;
|
||||
|
||||
let res = self.executor.run_command_and_measure(
|
||||
self.command,
|
||||
benchmark_iteration,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
use std::time::Duration;
|
||||
use indicatif::{FormattedDuration, ProgressBar, ProgressState, ProgressStyle};
|
||||
use std::fmt;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use crate::options::OutputStyleOption;
|
||||
|
||||
@@ -9,13 +10,44 @@ const TICK_SETTINGS: (&str, u64) = ("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏ ", 80);
|
||||
#[cfg(windows)]
|
||||
const TICK_SETTINGS: (&str, u64) = (r"+-x| ", 200);
|
||||
|
||||
// Keep the message area 30 columns wide across preparation, the initial run,
|
||||
// and estimates so that switching between them does not move the bar.
|
||||
const DEFAULT_TEMPLATE: &str = " {spinner} {msg:<30} {wide_bar} ETA {eta_precise} ";
|
||||
const INITIAL_TEMPLATE: &str =
|
||||
" {spinner} Initial run: {initial_elapsed:<17} {wide_bar} ETA {eta_precise} ";
|
||||
|
||||
/// Show the time elapsed since the initial benchmark command started.
|
||||
pub fn start_initial_measurement(bar: &ProgressBar, started: Instant) {
|
||||
let style = bar
|
||||
.style()
|
||||
.template(INITIAL_TEMPLATE)
|
||||
.expect("no template error")
|
||||
.with_key(
|
||||
"initial_elapsed",
|
||||
move |_: &ProgressState, w: &mut dyn fmt::Write| {
|
||||
write!(w, "{}", FormattedDuration(started.elapsed())).unwrap();
|
||||
},
|
||||
);
|
||||
bar.set_style(style);
|
||||
}
|
||||
|
||||
/// Stop showing the initial timer and display the next phase's message.
|
||||
pub fn finish_initial_measurement(bar: &ProgressBar, message: String) {
|
||||
bar.set_message(message);
|
||||
bar.set_style(
|
||||
bar.style()
|
||||
.template(DEFAULT_TEMPLATE)
|
||||
.expect("no template error"),
|
||||
);
|
||||
}
|
||||
|
||||
/// Return a pre-configured progress bar
|
||||
pub fn get_progress_bar(length: u64, msg: &str, option: OutputStyleOption) -> ProgressBar {
|
||||
let progressbar_style = match option {
|
||||
OutputStyleOption::Basic | OutputStyleOption::Color => ProgressStyle::default_bar(),
|
||||
_ => ProgressStyle::default_spinner()
|
||||
.tick_chars(TICK_SETTINGS.0)
|
||||
.template(" {spinner} {msg:<30} {wide_bar} ETA {eta_precise} ")
|
||||
.template(DEFAULT_TEMPLATE)
|
||||
.expect("no template error"),
|
||||
};
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@ use crate::quantity::{nanosecond, Information, Time, Zero};
|
||||
|
||||
#[cfg(not(feature = "windows_process_extensions_main_thread_handle"))]
|
||||
#[allow(non_upper_case_globals)]
|
||||
static NtResumeProcess: Lazy<unsafe extern "system" fn(ProcessHandle: HANDLE) -> NTSTATUS> =
|
||||
static NtResumeProcess: Lazy<unsafe extern "system" fn(process_handle: HANDLE) -> NTSTATUS> =
|
||||
Lazy::new(|| {
|
||||
// SAFETY: Getting the module handle for ntdll.dll is safe
|
||||
let ntdll = unsafe { GetModuleHandleW(w!("ntdll.dll")) };
|
||||
assert!(ntdll != std::ptr::null_mut(), "GetModuleHandleW failed");
|
||||
assert!(!ntdll.is_null(), "GetModuleHandleW failed");
|
||||
|
||||
// SAFETY: The ntdll handle is valid
|
||||
let nt_resume_process = unsafe { GetProcAddress(ntdll, s!("NtResumeProcess")) };
|
||||
@@ -57,10 +57,7 @@ impl CPUTimer {
|
||||
|
||||
// SAFETY: Creating a new job object is safe
|
||||
let job_object = unsafe { CreateJobObjectW(ptr::null_mut(), ptr::null_mut()) };
|
||||
assert!(
|
||||
job_object != std::ptr::null_mut(),
|
||||
"CreateJobObjectW failed"
|
||||
);
|
||||
assert!(!job_object.is_null(), "CreateJobObjectW failed");
|
||||
|
||||
// SAFETY: The job object handle is valid
|
||||
let ret = unsafe { AssignProcessToJobObject(job_object, child_handle) };
|
||||
|
||||
Reference in new issue
Block a user