I have a benchmark use-case where I want to save extra data files for each run, for a more detailed analysis later.
I want to benchmark the number of garbage collection events in a program profile.
My run-tool can easily take the parameter I'm scanning as one argument and the directory as another.
But it is a little convoluted to do today.
One attempt is to forgo --runs and use a --parameter-scan for the runs
$ hyperfine \
--parameter-scan run 0 5 \
--parameter-list mem 150,160 \
-- './benchmark-different-memory {mem}m {run}'
error: the argument '--parameter-scan <VAR> <MIN> <MAX>' cannot be used with '--parameter-list <VAR> <VALUES>'
Working solution as a command executor. Though the time benchmark breaks as we set runs to 1.
Else it does both the default number of runs, and the parameter-list for runs.
This is okay, as I do not care about warmups today, but ideally a warmup should be used.
Then a two-dimensional parameter list could be --parameter-list run WARMUP{1,2} $(seq 5) or something.
One can also hack the code to save the index
For the reference: I also hacked in the index into the run function,
and the run can be taken from the environment.
If someone wants a stricter API.
$ target/debug/hyperfine --runs 3 --parameter-scan x 1 2 env --show-output | grep HYPERFINE_RUN_INDEX
HYPERFINE_RUN_INDEX=0
HYPERFINE_RUN_INDEX=1
HYPERFINE_RUN_INDEX=2
Warning: Command took less than 5 ms to complete. Note that the results might be inaccurate because hyp
erfine can not calibrate the shell startup time much more precise than this limit. You can try to use the
`-N`/`--shell=none` option to disable the shell completely.
HYPERFINE_RUN_INDEX=0
HYPERFINE_RUN_INDEX=1
HYPERFINE_RUN_INDEX=2
And my use case then looks like this, the environment variable is expanded in the run-shell.
Hi
I have a benchmark use-case where I want to save extra data files for each run, for a more detailed analysis later. I want to benchmark the number of garbage collection events in a program profile.
My run-tool can easily take the parameter I'm scanning as one argument and the directory as another. But it is a little convoluted to do today.
Attempts
One attempt is to forgo
--runs
and use a--parameter-scan
for the runsWorking solution as a command executor. Though the time benchmark breaks as we set runs to 1. Else it does both the default number of runs, and the parameter-list for runs.
Using two parameter-lists instead works:
This is okay, as I do not care about warmups today, but ideally a warmup should be used. Then a two-dimensional parameter list could be
--parameter-list run WARMUP{1,2} $(seq 5)
or something.One can also hack the code to save the index
For the reference: I also hacked in the index into the run function, and the run can be taken from the environment. If someone wants a stricter API.
And my use case then looks like this, the environment variable is expanded in the run-shell.