Commit Graph
64 Commits
Author SHA1 Message Date
David Peter 445b6130f7 Use a shell for lifecycle commands and improve hook errors 2026-10-07 10:50:06 +02:00
David Peter 63209515a3 Improve command and hook failure diagnostics 2026-10-07 10:20:07 +02:00
David Peter bdbfae9907 Alternative performance metrics in the terminal (#986) 2026-10-06 15:50:19 +02:00
David Peter ab86cb99cc Make --shell=none the default (#982) 2026-10-06 08:41:59 +02:00
David Peter eedec07812 Cover JSON exports with integration snapshots 2026-10-05 20:42:13 +02:00
David Peter 95118147af Rename peak memory metric to memory_peak_resident 2026-10-05 20:23:55 +02:00
David Peter 0d86e78ede Refine JSON schema and command metadata 2026-10-05 18:11:10 +02:00
David Peter c5d3a81fc5 Include raw commands in JSON exports when names differ 2026-10-05 17:02:34 +02:00
David Peter 02b0db5c96 Adapt tests to rebased reference handling 2026-10-05 16:03:23 +02:00
David Peter 4cd0e24586 Document JSON measurements and omit unavailable memory metrics 2026-10-05 16:01:30 +02:00
David Peter 2e6abb70d1 Snapshot reference Markdown output 2026-10-05 15:38:46 +02:00
David Peter 92330ce75d Snapshot reference comparison output 2026-10-05 15:33:13 +02:00
David Peter 463a889638 Simplify parameterized reference handling 2026-10-05 15:07:46 +02:00
David Peter f7429e2fb2 Use parameterized benchmarks as references 2026-10-05 14:59:18 +02:00
David Peter 1eafcf4739 Combine iteration environment variable integration tests 2026-10-05 12:38:53 +02:00
willcl-ark 44c0cc231b expose HYPERFINE_ITERATION to intermediate commands
Fixes: #781

Expose the `$HYPERFINE_ITERATION` variable to intermediate commands.
This will allow iteration-specific prepare/conclude, such as:

```bash
hyperfine --runs 5 --prepare 'echo touch file${HYPERFINE_ITERATION}.dat' \
    'echo testing file${HYPERFINE_ITERATION}.dat' \
    --conclude 'echo rm file${HYPERFINE_ITERATION}.dat' --show-output
```
2026-10-05 12:24:43 +02:00
David Peter 9bf42b337d Snapshot test 2026-10-05 12:04:09 +02:00
Eric Soler a760e75f2f Preserve backticks in Markdown command names 2026-10-05 12:01:42 +02:00
David Peter 862625fb3d Merge pull request #951 from Likio3000/codex/reject-negative-parameter-steps
Reject negative parameter steps before expanding ranges
2026-10-05 11:32:10 +02:00
David Peter d3d67fc908 Merge pull request #950 from Likio3000/codex/preserve-exports-on-invalid-options
Preserve export files when command options are invalid
2026-10-05 11:30:58 +02:00
David Peter a24f76c0ce Use insta-cmd for benchmark report snapshots 2026-10-05 10:11:53 +02:00
David Peter 1e2e0be25c Use inline snapshots for execution logs and benchmark reports 2026-10-05 09:54:04 +02:00
Eric Soler 31ae72b2b7 Reject negative parameter steps before expanding ranges 2026-10-03 16:23:02 +00:00
Eric Soler e2717c064e Preserve export files when command options are invalid 2026-10-03 15:09:02 +00:00
907de26344 Fix panic on --runs 0 (#923)
* fix: reject --runs/--max-runs 0, clamp --min-runs to 1

* Validate positive run counts with clap

---------

Co-authored-by: VXNCXNX <VXNCXNX@users.noreply.github.com>
Co-authored-by: David Peter <mail@david-peter.de>
2026-10-02 09:56:27 +00:00
c0b3834277 Handle broken pipe errors on stdout gracefully (#932)
Replace `println!` calls on the results paths with `writeln!` on
`io::stdout()` and propagate the `io::Error` to `main`, where
`ErrorKind::BrokenPipe` is turned into a quiet `exit(0)`. This matches
the conventional behavior of command-line tools when their output pipe
is closed early (e.g. `hyperfine ... | head -n 0`), and fixes panics in
all run-output paths: the per-benchmark header and results, the speed
comparison summary, and `-`-style exports to stdout. The warnings and
"Note" outputs to stderr are converted the same way.


---------

Co-authored-by: Mathjk <Mathjk@users.noreply.github.com>
Co-authored-by: David Peter <mail@david-peter.de>
2026-10-02 11:18:56 +02:00
David Peter b5a6860d96 Support list of exit codes in --ignore-failure 2025-11-18 09:19:27 +01:00
Niklas Dewally 2166c9f02e Add option to name reference command
Add --reference-name option to give a reference command a name.

This was discussed in the PR that added --reference, #744, but
was unfortunately never implemented.
2025-09-03 20:45:39 +02:00
Ritvik 3bd38f275e fix(tests): restrict 'cat' tests to unix environments. Fixes #776 (#777)
Tests using the 'cat' command are specific
to unix-like environments and
fail on unsupported platforms.
2025-01-04 22:27:16 +01:00
Jan-Eric Nitschke 13547e973c Change message for identical time and add test for it 2024-06-30 22:45:40 +02:00
Jan-Eric Nitschke d4749b015f Fix prepare and conclude behaviour and add tests. 2024-06-30 22:45:40 +02:00
Jack O'Connor e13d0cb144 Add --conclude option with tests
This implementation of --conclude is basically identical
to the existing implementation for --prepare. I have not
adapted any existing tests. All tests which test --conclude
functionality are new.

The --conclude commands will run in the same order in which
they are supplied on the cli in the same manner as --prepare
and there must either be one --conclude command, or else the
same number of --concludes as there are commands.
2024-02-02 17:46:23 +01:00
David Peter 4564977b7a Add support for microseconds, closes #684 2023-10-05 09:39:00 +02:00
Pedro Witzel c2f99e5f94 fmt: apply cargo fmt suggestions 2023-10-05 09:25:07 +02:00
Pedro Witzel 25331f89f9 test: windows quote arg 2023-10-05 09:25:07 +02:00
David Peter ac617c8714 Add new --sort option
This adds a new `--sort` option to choose the way in which the results
in the speed comparison and the markup exports are ordered.

closes #614
closes #601
2023-06-03 21:34:36 +02:00
David Peter a8752769ab Show unused parameters in command names
closes #600
2023-04-20 21:39:23 +02:00
David Peter 4b9cd06d86 Add regression test for #642 2023-04-20 13:22:00 +02:00
David Peter bf9644d74a Add regression test for #640 2023-04-20 13:22:00 +02:00
David Peter e4790ab441 Change error message 2023-03-15 09:33:49 +01:00
David Peter 09af0517bc Rename test file 2023-03-15 09:33:49 +01:00
Steve Nease d32b90ee5c Add the rest of the suggestions from code review 2023-03-15 09:33:49 +01:00
Steve Nease 0e3bad1391 ran cargo fmt 2023-03-15 09:33:49 +01:00
Steve Nease e38acdb683 Added --stdin-data argument
This argument accepts a path to a file. The data contained in the file will be passed to the command via stdin.

Closes sharkdp/hyperfine#541
2023-03-15 09:33:49 +01:00
David Peter d13454a0d4 Add additional integration test for failing command 2022-02-22 22:51:09 +01:00
David Peter e666b01e09 Add simple integation test for --shell=none 2022-02-22 22:51:09 +01:00
David Peter 365ff2584d Switch to --shell=none/-N, do not change the default 2022-02-22 22:51:09 +01:00
David Peter d9418e0731 Use raw executor by default, skip intermediate shell
This adds a new "raw executor" (next to the "shell executor") that
allows hyperfine to execute commands directly without any intermediate
shell.

The command line is split into tokens (using the `shell-words` crate),
and according to POSIX rules. The first token is taken as the executable,
and the rest as arguments.

The new executor is enabled by default. In order to select the shell
executor, users will have to pass `--shell=default`.

This allows us to reduce measurement noise and to benchmark very quick
commands. It also decreases the time to run benchmarks, as we don't need
the calibration phase.

Also, it allows one to make sure that the executed command is not
implemented as a shell builtin. For example `hyperfine true`
and `hyperfine --shell=default true` return different times due
to the fact that `bash` executes `true` as a NOP.

Co-authored: Ciprian Dorin Craciun <ciprian@volution.ro>
2022-02-22 22:51:09 +01:00
David Peter d27cbceed2 Add integration test for --show-output 2022-02-22 13:24:05 +01:00
David Peter 6887835f34 Proper shell overhead computation 2022-02-22 09:07:40 +01:00