Skip to content

Using --prepare increases benchmark results #715

Open
@hnorkowski

Description

@hnorkowski

When using hyperfine I noticed that it always reported worse performance when using the --prepare option to execute a command in between runs even if the command should not have any effect on the system or the benchmark command. I tested --prepare with commands like sleep 1 and curl <some address>. As benchmark command I used echo test. This is a very short command and hyperfines warns about it and suggests using --shell=none but even with that it happens. Here is a recording.

To make sure its not only with very short commands I also tested it with a slower command: Reading 3000000 bytes from /dev/urandom but it showed the same effect but the impact was smaller, probably because its a constant slowdown or it grows much slower than the overall execution time. Recording.

Is this expected behavior for some reason? Or is it a bug?

Also another question: Why is using --shell=none so much slower in the echo test example? Is it because of stdin and stdout connections?


Some system information:

❯ hyperfine --version
hyperfine 1.18.0

Arch Linux with 6.6.9-arch1-1 (btw)
CPU: Ryzen 5900x
Desktop: i3wm
Executed in: Alacritty -> Fish Shell -> Zellij

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions