Commit Graph
39 Commits
Author SHA1 Message Date
Benjamin Rombaut fcaa6d32dc chore: run fmt 2022-11-19 15:13:30 +01:00
Benjamin Rombaut 27ec9e22d8 use set and settrue 2022-11-19 15:13:30 +01:00
Benjamin Rombaut 5fcb7166a9 add clap deprecation notices 2022-11-19 15:13:30 +01:00
FilipAndersson f00acf962e Fixes #568 2022-10-29 14:58:57 +02:00
наб af2f0ace22 Default to $TERM unset = colour on Win32
This otherwise respects all other configuration
(NO_COLOR, TERM=dumb, &c.), but it's very common for the environment to
be lacking TERM, which in that case usually means a pro-verbial
TERM=cmd.exe, which is colourful

Fixes: 049d1138c9 ("Don't output colours
 by default if TERM=dumb or NO_COLOR=1")
2022-10-29 14:48:25 +02:00
David Peter c7e56942f7 Fix clippy suggestions 2022-09-07 09:20:50 +02:00
David Peter dffbdc34d4 Add new (hidden) --min-benchmarking-time option 2022-09-07 09:13:53 +02:00
David Peter 9fefe9af31 Rewrite boolean condition 2022-09-07 08:44:57 +02:00
наб 049d1138c9 Don't output colours by default if TERM=dumb or NO_COLOR=1
This matches ZFS, and is mostly état d'art

Closes #542
2022-09-02 13:38:37 +02:00
Tavian Barnes 3df63ba2bb Address review comments 2022-05-17 22:30:45 +02:00
Tavian Barnes efdf735723 Forbid --output=file without a path separator 2022-05-17 22:30:45 +02:00
Tavian Barnes ecee9df575 Add --output=inherit as an alias for --show-output 2022-05-17 22:30:45 +02:00
Tavian Barnes 277807cb5a Implement --output={null,pipe,<FILE>}
Fixes #377.
2022-05-17 22:30:45 +02: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 9b8f2a9ee2 Move Stdio extraction to enum 2022-02-22 13:24:05 +01:00
David Peter f029a46ff9 Fix clippy warnings 2022-02-22 10:13:06 +01:00
David Peter 6887835f34 Proper shell overhead computation 2022-02-22 09:07:40 +01:00
David Peter 6f51232a8a Add debug/mock mode 2022-02-22 09:07:40 +01:00
David Peter 811e6b5fcd Rename test 2022-02-22 09:07:40 +01:00
David Peter 6645fa10b9 Use get_program 2022-02-22 09:07:40 +01:00
David Peter 21f76a338f Remove unused option 2022-02-22 09:07:40 +01:00
David Peter f9e62e5e7f Rename parse to from_str 2022-02-22 09:07:40 +01:00
David Peter 0ebd76dfc2 Turn show_output into enum 2022-02-22 09:07:40 +01:00
David Peter bea0cfab30 Rename Runs to RunBounds 2022-02-22 09:07:40 +01:00
David Peter 250db61fa0 Fix clippy warning 2022-02-22 09:07:40 +01:00
David Peter 72d27729fa New Scheduler struct 2022-02-19 16:53:02 +01:00
David Peter 5c634c9f2f Move a few modules to util 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 a35e7e2caf Fix formatting 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
Æ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
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 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