Coder Social home page Coder Social logo

Option to disable "Warning: Unable to complete 10 samples in 5.0s. You may wish to increase target time to 89.5s." about criterion.rs HOT 2 OPEN

kevincox avatar kevincox commented on August 19, 2024 1
Option to disable "Warning: Unable to complete 10 samples in 5.0s. You may wish to increase target time to 89.5s."

from criterion.rs.

Comments (2)

adsick avatar adsick commented on August 19, 2024

I have the same problem, except it does not complete in reasonable time, the code:

use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
use rand::prelude::*;

pub fn lookup(c: &mut Criterion) {
    let mut group = c.benchmark_group("lookup");

    for size in (0..4*1024*1024).step_by(1024*1024) {
        let mut rng = thread_rng();
        let mut data: Vec<u64> = vec![0; size];
        rng.fill(&mut data[..]);

        let mut keys = data.clone();
        keys.shuffle(&mut rng);

        group.bench_with_input(BenchmarkId::new("linear", size), &size, |b, size| {
            b.iter(|| {
                for key in &keys {
                    black_box(data.contains(key));
                }
            });
        });

        let mut rng = thread_rng();
        let mut data: Vec<u64> = vec![0; size];
        rng.fill(&mut data[..]);

        let mut keys = data.clone();
        keys.shuffle(&mut rng);

        group.bench_with_input(BenchmarkId::new("constant", size), &size, |b, size| {
            b.iter(|| {
                for key in &keys {
                    black_box(data.contains(key));
                }
            });
        });
    }
    group.finish();
}

criterion_group!(benches, lookup);
criterion_main!(benches);

I tried to reduce number of samples and confidence level like this: group.confidence_level(0.6).sample_size(12); but it didn't really help.

from criterion.rs.

adsick avatar adsick commented on August 19, 2024
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 15150.2s, or reduce sample count to 10.
Benchmarking lookup/linear/1048576: Collecting 100 samples in estimated  15150 s (100 iterations)

from criterion.rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.