nvzqz / divan

Fast and simple benchmarking for Rust projects
https://nikolaivazquez.com/blog/divan/
Apache License 2.0
849 stars 24 forks source link

Fixed Error when running example benchmarks with divan specific args #47

Closed OliverKillane closed 1 month ago

OliverKillane commented 4 months ago

Context

Noticed by @cameronelliott From the readme, the benchmark run instructions are:

cargo bench -q -p examples --all-features

But when running with extra flags (e.g. --bytes-format) we get the following error:

cargo bench -q -p examples -- --bytes-format=decimal  

# correct output ...

error: Unrecognized option: 'bytes-format'
error: bench failed, to rerun pass `-p examples --bench util`

This is as utils.rs is being compiled and run as a benchmark.

Possible Solutions

  1. Ignore (we dont care about this non-benchmark failing, the others happily succeed)
  2. Use environment variable (e.g. DIVAN_BYTES_FORMAT=...) (only read by the benchmarks that need it, hence no errors present)
  3. utils.rs is only used by collections.rs, small enough to just move into collections.rs

Goals