bheisler / cargo-criterion

Cargo extension for running Criterion.rs benchmarks
Apache License 2.0
184 stars 23 forks source link

Benchmarking on remote maschine / Report generation off-line #30

Open ialokim opened 3 years ago

ialokim commented 3 years ago

Thanks a lot for your great benchmarking library!

Now that analyzing and plotting of results has been moved to cargo-criterion, I wonder if there is already some easy way to do benchmarks on a remote machine. Currently, I'm cross-compiling my criterion benchmarks for a Raspberry Pi Zero via cargo bench --target arm-unknown-linux-gnueabihf which successfully generates binaries that I can run on the Pi with --bench. Due to the very limited resources of this device I don't want to install rust and cargo on the Pi itself and thus cannot use cargo-criterion directly. Also report generation (especially plotting) is very slow on the Pi, so I would like to shift that part of the task to my work machine.

I already know that I can disable plot generation via --noplot. Is there some way to generate the reports afterwards on another computer using the raw data from the Pi? Or even better, does cargo-criterion support benchmarking on a remote machine?

Anton-4 commented 3 years ago

Hi @ialokim I'm also trying to compile benchmarks on one machine and run them on another. After compiling with --target arm-unknown-linux-gnueabihf do you than copy the whole project folder to the Pi or is there a way to benchmark with only the binaries?

ialokim commented 3 years ago

You can definitely run the benchmark binary directly on your target machine. You can find it under ./target/arm-unknown-linux-gnueabihf/release/deps/{name}-*, with the name used in the Cargo.toml file. So just copy that binary to, let's say, the Pi and execute it with ./{name}.* --bench --noplot (noplot if you want to disable plot generation which I'd strongly recommend for constrained devices).

This approach does not use cargo-criterion at all, just the criterion crate.

Anton-4 commented 3 years ago

Awesome, thanks for the help @ialokim!

bheisler commented 3 years ago

Hello! Thanks for the suggestion.

This is an interesting idea. It probably won't be a priority for me to implement, but I'll leave this open as a note for future development.