criterion.rs: error: Unrecognized option: 'save-baseline'
Hi guys, thanks for this great library!
This seems very simple, so it may be my mistake. I am running the following benchmark from /benches/benchmarks.rs
:
fn main(){
// make Criterion listen to command line arguments
let mut c = Criterion::default().configure_from_args();
c.bench(
"name",
Benchmark::new("dosomething", move |b| {
// set up things
b.iter(||
// do thing
)
})
// Limit the measurement time and the sample size
// to make sure the benchmark finishes in a feasible amount of time.
.measurement_time(Duration::new(100, 0)).sample_size(20)
);
}
Running cargo bench
works, and faithfully runs the above benchmark.
I want to use the --save-baseline
command line argument, however, and provide it way the docs suggest:
cargo bench -- --save-baseline master
This produces the following error:
Finished release [optimized] target(s) in 0.13s
Running target/release/deps/abclib-60df177b6b7c338b
error: Unrecognized option: 'save-baseline'
error: bench failed
Initiating the benchmark using the criterion_main!(*)
macros instead does not change this.
What is going wrong?
I am running all this on stable. Versions:
cargo 1.28.0 (96a2c7d16 2018-07-13)
stable-x86_64-apple-darwin
rustc 1.28.0 (9634041f0 2018-07-30)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 6
- Comments: 15 (7 by maintainers)
Commits related to this issue
- Fix criterion integration https://github.com/bheisler/criterion.rs/issues/193 — committed to kornelski/rustface by kornelski 4 years ago
- Fix criterion integration https://github.com/bheisler/criterion.rs/issues/193 — committed to atomashpolskiy/rustface by kornelski 4 years ago
- Add `bench = false` to `Cargo.toml` This should solve issue with benches See: https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-lin... — committed to arturomf94/sycret by arturomf94 3 years ago
- Add `bench = false` to `Cargo.toml` (#27) This should solve issue with benches See: https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-co... — committed to OpenMined/sycret by arturomf94 3 years ago
- fix bench command line options (#1685) fix to criterion bench not accepts options ``` error: Unrecognized option: 'save-baseline' error: bench failed ``` https://github.com/bheisler/criterion.... — committed to apache/arrow-rs by kazuk 2 years ago
- bench is false https://github.com/bheisler/criterion.rs/issues/193 — committed to bee-san/Ares by deleted user 2 years ago
- bench is false https://github.com/bheisler/criterion.rs/issues/193 — committed to bee-san/Ares by deleted user 2 years ago
- bench is false https://github.com/bheisler/criterion.rs/issues/193 — committed to bee-san/Ares by deleted user 2 years ago
- bench is false https://github.com/bheisler/criterion.rs/issues/193 — committed to bee-san/Ares by deleted user 2 years ago
- Disable unused bench for Criterion compatibility https://github.com/bheisler/criterion.rs/issues/193 — committed to kornelski/image-gif by kornelski 9 months ago
- Do not try to benchmark normal test cases Currently running cargo bench -- --save-baseline master doesn't work, for the reasons outlined in [1]. Apply the fix in the comment ([2]) to not try to load... — committed to TobiasBengtsson/crc24-openpgp-fast by TobiasBengtsson 7 months ago
I think that should work, yes. I would go with
cargo bench --bench benchmarks -- --save-baseline foo
instead, as it’s simpler. It is possible to disable benchmarks in the test exe in yourCargo.toml
as well, that would also solve this:Oh, I see. That is a different entry in the FAQ:
https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options