-
Notifications
You must be signed in to change notification settings - Fork 310
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
crash in quick mode without "--noplot" when there is no time variation #658
Comments
P.S.: The error goes away when I disable plotting with |
P.P.S.: This error only occurs when the time goes above around 5 seconds, then it gets reported as 1 ms. |
Minimal Working Exampleuse criterion::{criterion_group, criterion_main, Criterion};
use std::{thread, time};
fn quick_bug(c: &mut Criterion) {
let one_second = time::Duration::from_secs(1);
let six_seconds = time::Duration::from_secs(6);
let mut group = c.benchmark_group("> 5 second quick bug test");
group.sample_size(10);
group.bench_function("1 seconds", |b| b.iter(|| thread::sleep(one_second)));
group.bench_function("6 seconds", |b| b.iter(|| thread::sleep(six_seconds)));
group.finish();
}
criterion_group!(benches, quick_bug);
criterion_main!(benches); quickbug$ cargo bench -- --quick
Compiling quickbug v0.1.0 (/home/konrad/tmp/quickbug)
Finished bench [optimized] target(s) in 0.71s
Running benches/bench.rs (target/release/deps/bench-1ea7ae8fa314d649)
> 5 second quick bug test/1 seconds
time: [1.0001 s 1.0001 s 1.0001 s]
> 5 second quick bug test/6 seconds
time: [1.0000 ms 1.0000 ms 1.0000 ms]
thread 'main' panicked at 'assertion failed: slice.len() > 1 && slice.iter().all(|x| !x.is_nan())', /home/konrad/tmp/criterion.rs/src/stats/univariate/sample.rs:31:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
Minimal Working Example Repository |
The error still occurs in version 0.5.0. |
When using quick mode without "--noplot", any benchmark running over 5 seconds will lead to a crash. This commit fixes this problem by adding a very small amount (that will not be reported due to rounding) in order to work around the gnuplot crash. See <bheisler#658>.
When I benchmark in normal mode, all is fine but with -- --quick I get
assertion failed: slice.len() > 1 && slice.iter().all(|x| !x.is_nan())
:Benchmark code:
The text was updated successfully, but these errors were encountered: