Commit Graph

264 Commits

Author SHA1 Message Date
David Peter
5df981ae7b Expand execution order tests 2022-02-06 22:50:11 +01:00
David Peter
6db82cdb2a Split range into range_step and commands 2022-02-06 22:49:04 +01:00
David Peter
a6baf49b72 Introduce Commands struct 2022-02-06 22:49:04 +01:00
David Peter
c5a2266199 New schedule module 2022-02-06 20:19:50 +01:00
David Peter
5c634c9f2f Move a few modules to util 2022-02-06 20:19:50 +01:00
David Peter
999e7c4566 Move more modules around 2022-02-06 20:19:50 +01:00
David Peter
47091a5740 New parameter module 2022-02-06 20:19:50 +01:00
David Peter
865290a144 New output module 2022-02-06 20:19:50 +01:00
David Peter
e5e4c8c020 New 'benchmark' module folder 2022-02-06 20:19:50 +01:00
David Peter
cd38e9c63b Move build_commands 2022-02-06 20:19:50 +01:00
David Peter
33f8d03d6b Move build_export_manager to ExportManager 2022-02-06 20:19:50 +01:00
David Peter
b54b2f81f4 Rename to Options 2022-02-06 20:19:50 +01:00
David Peter
39a85b88cf Move convert_cli_arguments_to_options to HyperfineOptions 2022-02-06 20:19:50 +01:00
David Peter
c4ae7f6f8c Fix Windows code 2022-02-06 20:19:50 +01:00
David Peter
d7e96928fb Fix format call 2022-02-06 20:19:50 +01:00
David Peter
a35e7e2caf Fix formatting 2022-02-06 20:19:50 +01:00
David Peter
c6477c7368 Rename function 2022-02-06 20:19:50 +01:00
David Peter
2040810ce3 Unified error handling 2022-02-06 20:19:50 +01:00
David Peter
81b737fdc1 Remove BenchmarkResult::new 2022-02-06 20:19:50 +01:00
David Peter
ce7087b107 Use thiserror for to derive Error 2022-02-06 20:19:50 +01:00
David Peter
f5de5487cc Fix clippy suggestions 2022-02-06 17:47:40 +01:00
David Peter
80a9f51710 Update to clap 3 2022-02-03 21:07:15 +01:00
Karl Heinz Marbaise
272b107684 Fixed #452 - Difference between markdown and asciidoctor output 2021-12-03 09:11:49 +01:00
Ævar Arnfjörð Bjarmason
017d55a4a1 Add --setup (-s) option, like --prepare but runs once per batch
Add a --setup option for the use-case of wanting to do one-off setup
before a set of benchmarks, not the once-per-test setup that --prepare
does. This is useful for the cases noted in the updated documentation.

Per the feedback on https://github.com/sharkdp/hyperfine/pull/448 this
new "--setup" option will steal the "-s" short option from
"--style" (initially this was called "--build" and used the
non-conflicting "-b").

Potential future work:

I'd prefer if this and --cleanup took N number of commands, so you
could do e.g.:

    hyperfine -L rev master,next \
        -b 'git worktree add /tmp/test-{r}'  \
        -b 'make -C /tmp/test-{r} all'  \
	'make -C /tmp/test-{r} test' \
	-c 'git worktree remove /tmp/test-{r}'

I.e. a shortcut around not providing these with &&, which makes things
a bit more readable.

But the --cleanup option doesn't do that, so let's just go with what
it's doing for consistency, so for this you'll now need to do:

    hyperfine -L rev master,next \
        -b 'git worktree add /tmp/test-{r} &&
	    make -C /tmp/test-{r} all'  \
	'make -C /tmp/test-{r} test' \
	-c 'git worktree remove /tmp/test-{r}'
2021-11-16 21:36:35 +01:00
David Peter
abd0d335ab Make stddev fields optional, hide "± σ" for 1 run 2021-11-14 10:28:24 +01:00
Ævar Arnfjörð Bjarmason
bffd476128 Add support for one run with --runs=1
Extend the --runs=N option added in d78c33b (Added options to specify
the max/exact numbers of runs., 2018-09-09) to support --runs=1
instead of dying with a usage error.

This is useful to do ad-hoc testing of your commands while they might
still have syntax errors, or just for doing one run where you don't
care about the stddev.

Before:

    $ /usr/bin/hyperfine -s basic -r 1 -L n 5,10 'sleep 0.{n}'
    Error: Number of runs below two

After (-s basic) also works:

    $ hyperfine -r 1 -L n 5,10 'sleep 0.{n}'
    Benchmark 1: sleep 0.5
      Time (abs ≡):        500.6 ms               [User: 0.6 ms, System: 0.0 ms]

    Benchmark 2: sleep 0.10
      Time (abs ≡):        100.8 ms               [User: 0.7 ms, System: 0.0 ms]

    Summary
      'sleep 0.10' ran
        4.97 ± 0.00 times faster than 'sleep 0.5'

This likewise combines correctly with -m and -M, probably not very
useful, but if you're tweaking an existing command-line:

    $ hyperfine -m 1 -M 1 -L n 5,10 'sleep 0.{n}'
    Benchmark 1: sleep 0.5
      Time (abs ≡):        500.6 ms               [User: 0.5 ms, System: 0.0 ms]

    Benchmark 2: sleep 0.10
      Time (abs ≡):        100.6 ms               [User: 0.6 ms, System: 0.0 ms]

    Summary
      'sleep 0.10' ran
        4.98 ± 0.00 times faster than 'sleep 0.5'

The "± 0.00" output in "faster than" should probably be adjusted too,
or we could keep it for consistency. I didn't implement that because
this is the first time I do anything in Rust, and I ran out of
template to copy when wanting to quickly implement this in
write_benchmark_comparison() in main.rs.
2021-11-14 10:28:24 +01:00
David Peter
58d3eada61 Enable colors on Windows, closes #427 2021-10-17 18:03:18 +02:00
Clément Joly
5c6b302591 Document different increase pattern for -P
Document values of `-P` increasing as powers of 2 and following other
patterns.

Fixes #403
2021-10-17 17:24:32 +02:00
David Peter
8a4e791025 Fix merge conflict 2021-10-17 17:10:46 +02:00
Heikki Hellgren
f592155db7 Fix clippy warnings from tests 2021-10-17 17:04:46 +02:00
rhysd
f2bfedd3a6 Fix clippy warnings 2021-10-17 17:03:36 +02:00
rhysd
1b7d139f21 Add tests for options::Shell 2021-10-17 17:03:36 +02:00
rhysd
e2fdaceb9f Parse --shell option value as shell command 2021-10-17 17:03:36 +02:00
David Peter
1027940e3a Completely remove internal.rs 2021-08-24 22:44:08 +02:00
David Peter
76dd9d40f0 Move relative-speed computation to separate module 2021-08-24 22:44:08 +02:00
David Peter
d5a2590b98 Move benchmark comparison to main.rs 2021-08-24 22:44:08 +02:00
David Peter
eb31e0f5f9 Move tokenize to new file 2021-08-24 22:44:08 +02:00
David Peter
13986b17f4 Move progress bar to separate module 2021-08-24 22:44:08 +02:00
David Peter
8618c86421 Fix float eq check 2021-08-24 22:44:08 +02:00
David Peter
9d61130b44 Remove timer/internal.rs 2021-08-24 22:44:08 +02:00
David Peter
60e9771ad5 Remove cfg-if dependency 2021-08-24 22:44:08 +02:00
David Peter
9df6174bc2 Re-order imports 2021-08-24 22:44:08 +02:00
David Peter
30c381fe2a Flat directory/module structure 2021-08-24 22:44:08 +02:00
David Peter
9b328ff354 Move BenchmarkResult to new file 2021-08-23 21:47:58 +02:00
David Peter
cbfd9f5b41 Move DEFAULT_SHELL to options 2021-08-23 21:47:58 +02:00
David Peter
465160b9aa Move Options struct to new module 2021-08-23 21:47:58 +02:00
David Peter
eee32308b7 Move Command struct to new module 2021-08-23 21:47:58 +02:00
David Peter
068bebb4e6 Fix remaining clippy warnings 2021-08-22 16:33:43 +02:00
David Peter
85730b3f0f Auto-fix clippy warnings 2021-08-22 16:33:43 +02:00
David Peter
f860c3cf6b Run cargo fmt 2021-08-22 15:51:28 +02:00