Skip to content
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

Custom Iter with async setup and non-async benched value #762

Open
Sapp00 opened this issue Mar 2, 2024 · 0 comments
Open

Custom Iter with async setup and non-async benched value #762

Sapp00 opened this issue Mar 2, 2024 · 0 comments

Comments

@Sapp00
Copy link

Sapp00 commented Mar 2, 2024

Hello,
I have the following bench:

pub fn criterion_benchmark_calc_path(c: &mut Criterion) {
    let runtime = Builder::new_multi_thread().enable_all().build().unwrap();

    c.bench_function("calc_path", |b| {
        b.to_async(&runtime).iter_custom(|iters| async{
                let mut olist = PathManager::get_list().await;

                let start = Instant::now();
                let _ = pm.calculate();

                start.elapsed()
        })
    });
}

When I run this bench, it returns 0 as time, but this doesnt make sense. When I add some noise with sleep, it returns only the sleep duration. Is there any known limitation to the async bencher?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant