-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error: Unrecognized option: 'save-baseline' #193
Comments
Which version of criterion are you using? The cargo.lock may be the easiest place to find that info. |
Ah, forgot the most crucial version number.. Sorry! [dev-dependencies]
criterion = "0.2.4" Which is supposed to be the latest version on crates.io, am I right? |
Thanks. You are correct, that should work. I am now in over my head. :-) |
I did some digging myself: Trying another Criterion command line flag: cargo bench -- --color Gives:
Leading me to believe that certain Criterion arguments DO reach the Criterion binary through Cargo. Next, I will try providing the cargo test --release --bench benchmarks -- --save-baseline somename At first glance, this seems to work (that is: not crash). |
Hey, thanks for trying Criterion.rs! Yeah, this is a bit confusing, but there's not much Criterion.rs can do about it. What's happening is that Cargo is trying to run your tests as benchmarks. Normally, the test executable just detects that there are no benchmarks to run and exits, then Cargo moves on to run your actual benchmarks. In this case, though, it sees a command-line-argument that it doesn't understand and fails, and Cargo stops before even trying to run the Criterion.rs benchmarks. See here for more details. This is why it works when you add the I'll leave this open as a reminder to clarify that section of the guide, though - there are several command-line parameters that might cause this now. I would strongly recommend using the |
Hi Brook, Thanks for your reply! Am I right in assuming that this means I can just use By the way, I'll go back to using the |
I think that should work, yes. I would go with [lib]
bench = false |
I've run into the same problem (rust stable 1.47 from rustup, criterion = "0.3"), and the workaround doesn't seem to work. If I run
and it ends immediately, without performing any actual benchmarking. I'm trying to run benches in https://github.com/atomashpolskiy/rustface |
I'm encountering the same issue as @kornelski. |
I believe that is the correct behavior. This is explained in the FAQ: https://bheisler.github.io/criterion.rs/book/faq.html#when-i-run-benchmark-executables-directly-without-using-cargo-they-just-print-success-why If you disagree, please raise a separate issue. I admit though, I am confused why you're trying to do benchmarking with |
I only tried |
Oh, I see. That is a different entry in the FAQ: |
I ran into this problem while I was trying out flags from |
That's a good idea! I haven't had much time to work on Criterion-rs lately. Could you raise a separate issue about that so I don't forget about it when I do? |
Sure thing, filed as #450. |
fix to criterion bench not accepts options ``` error: Unrecognized option: 'save-baseline' error: bench failed ``` bheisler/criterion.rs#193 (comment)
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 the normal tests during benchmarking. [1]: bheisler/criterion.rs#193 [2]: bheisler/criterion.rs#193 (comment)
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
: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:This produces the following error:
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:
The text was updated successfully, but these errors were encountered: