Skip to content

Unclear how to use --reference with --prepare #847

@gsnedders

Description

@gsnedders

See:

gsnedders@gsnedders-margot ~ % hyperfine --show-output -N -r1 -L delay 0.2,0.4,0.6 -p 'sleep {delay}' 'echo a'
Benchmark 1: echo a (delay = 0.2)
a
  Time (abs ≡):          9.2 ms               [User: 1.7 ms, System: 3.1 ms]
 
Benchmark 2: echo a (delay = 0.4)
a
  Time (abs ≡):          9.1 ms               [User: 1.9 ms, System: 3.5 ms]
 
Benchmark 3: echo a (delay = 0.6)
a
  Time (abs ≡):         10.3 ms               [User: 1.8 ms, System: 3.5 ms]
 
Summary
  echo a (delay = 0.4) ran
    1.01 times faster than echo a (delay = 0.2)
    1.14 times faster than echo a (delay = 0.6)
gsnedders@gsnedders-margot ~ % hyperfine --show-output -N -r1 -L delay 0.2,0.4,0.6 -p 'sleep {delay}' --reference 'echo a (delay = 0.4)' 'echo a'
Benchmark 1: echo a (delay = 0.4)
sleep: invalid time interval: {delay}
usage: sleep number[unit] [...]
Unit can be 's' (seconds, the default), m (minutes), h (hours), or d (days).
Error: The preparation command terminated with a non-zero exit code. Append ' || true' to the command if you are sure that this can be ignored.
gsnedders@gsnedders-margot ~ % hyperfine --show-output -N -r1 -L delay 0.2,0.4,0.6 -p 'sleep {delay}' --reference 'delay = 0.4' 'echo a'
Benchmark 1: delay = 0.4
sleep: invalid time interval: {delay}
usage: sleep number[unit] [...]
Unit can be 's' (seconds, the default), m (minutes), h (hours), or d (days).
Error: The preparation command terminated with a non-zero exit code. Append ' || true' to the command if you are sure that this can be ignored.
gsnedders@gsnedders-margot ~ % hyperfine --show-output -N -r1 -L delay 0.2,0.4,0.6 -p 'sleep {delay}' --reference 'echo b' 'echo a'
Benchmark 1: echo b
sleep: invalid time interval: {delay}
usage: sleep number[unit] [...]
Unit can be 's' (seconds, the default), m (minutes), h (hours), or d (days).
Error: The preparation command terminated with a non-zero exit code. Append ' || true' to the command if you are sure that this can be ignored.

It would be nice to be able to set one of the specific benchmarks from the first command as the reference, but I can't see how?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions