From 6a08fd153587608d66a088bd5deee9eeee40c5c0 Mon Sep 17 00:00:00 2001 From: Aria Shrimpton Date: Sun, 10 Mar 2024 18:37:59 +0000 Subject: benchmark improvements --- src/tests/example_sets/benches/main.rs | 2 +- src/tests/example_sets/src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests/example_sets/benches/main.rs b/src/tests/example_sets/benches/main.rs index 7b46c8e..26e8547 100644 --- a/src/tests/example_sets/benches/main.rs +++ b/src/tests/example_sets/benches/main.rs @@ -1,7 +1,7 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; fn run_benches(c: &mut Criterion) { - for size in [500, 10_000, 50_000].iter() { + for size in [500, 2_000, 10_000, 50_000].iter() { c.bench_with_input( BenchmarkId::new("example_sets-insert_n", size), size, diff --git a/src/tests/example_sets/src/lib.rs b/src/tests/example_sets/src/lib.rs index dff5a27..c5bd163 100644 --- a/src/tests/example_sets/src/lib.rs +++ b/src/tests/example_sets/src/lib.rs @@ -14,7 +14,7 @@ pub fn insert_n(n: usize) { set.insert(random()); } - for i in 0..2 * n { - black_box(|x| x)(black_box(set.contains(&i))); + for _ in 0..2 * n { + black_box(|x| x)(black_box(set.contains(&random()))); } } -- cgit v1.2.3