From ce96431ce2a5c9c27d3e91742af65630dd894052 Mon Sep 17 00:00:00 2001 From: Raphael Druon Date: Thu, 8 Aug 2024 08:20:13 -0600 Subject: [PATCH] Fix bench --- lustre-collector/Cargo.toml | 3 +++ lustrefs-exporter/benches/jobstats.rs | 12 ++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lustre-collector/Cargo.toml b/lustre-collector/Cargo.toml index 0c228f8..9355fd1 100644 --- a/lustre-collector/Cargo.toml +++ b/lustre-collector/Cargo.toml @@ -19,3 +19,6 @@ tracing.workspace = true [dev-dependencies] include_dir.workspace = true insta.workspace = true + +[lib] +bench = false diff --git a/lustrefs-exporter/benches/jobstats.rs b/lustrefs-exporter/benches/jobstats.rs index 486d67c..3376ba7 100644 --- a/lustrefs-exporter/benches/jobstats.rs +++ b/lustrefs-exporter/benches/jobstats.rs @@ -37,16 +37,12 @@ job_stats:{}"#, str_repeat!(JOBSTAT_JOB, 1000) ); -async fn parse_synthetic_yaml(input: &'static str, len: usize) { +async fn parse_synthetic_yaml(input: &'static str) { let f = BufReader::with_capacity(128 * 1_024, input.as_bytes()); let (fut, mut rx) = jobstats_stream(f); - let mut cnt = 0; - - while rx.recv().await.is_some() { - cnt += 1; - } + while rx.recv().await.is_some() {} fut.await.unwrap(); } @@ -54,11 +50,11 @@ async fn parse_synthetic_yaml(input: &'static str, len: usize) { fn criterion_benchmark_fast(c: &mut Criterion) { c.bench_function("jobstats 100", |b| { b.to_async(tokio::runtime::Builder::new_multi_thread().build().unwrap()) - .iter(|| black_box(parse_synthetic_yaml(INPUT_100_JOBS, 100))) + .iter(|| black_box(parse_synthetic_yaml(INPUT_100_JOBS))) }); c.bench_function("jobstats 1000", |b| { b.to_async(tokio::runtime::Builder::new_multi_thread().build().unwrap()) - .iter(|| black_box(parse_synthetic_yaml(INPUT_1000_JOBS, 1000))) + .iter(|| black_box(parse_synthetic_yaml(INPUT_1000_JOBS))) }); } criterion_group! {