summaryrefslogtreecommitdiffstats
path: root/benches/benches.rs
diff options
context:
space:
mode:
Diffstat (limited to 'benches/benches.rs')
-rw-r--r--benches/benches.rs33
1 files changed, 25 insertions, 8 deletions
diff --git a/benches/benches.rs b/benches/benches.rs
index 39368d2..caed17c 100644
--- a/benches/benches.rs
+++ b/benches/benches.rs
@@ -65,17 +65,34 @@ fn bench_nearest_neighbors(c: &mut Criterion) {
let index = $type::from_iter(points.clone());
group.bench_function("nearest", |b| b.iter(
- || index.nearest(&target))
- );
+ || index.nearest(&target)
+ ));
group.bench_function("nearest_within", |b| b.iter(
- || index.nearest_within(&target, 0.1))
- );
+ || index.nearest_within(&target, 0.1)
+ ));
group.bench_function("k_nearest", |b| b.iter(
- || index.k_nearest(&target, 3))
- );
+ || index.k_nearest(&target, 3)
+ ));
group.bench_function("k_nearest_within", |b| b.iter(
- || index.k_nearest_within(&target, 3, 0.1))
- );
+ || index.k_nearest_within(&target, 3, 0.1)
+ ));
+
+ group.bench_function("merge_k_nearest", |b| b.iter_batched(
+ || Vec::with_capacity(3),
+ |mut n| {
+ index.merge_k_nearest(&target, 3, &mut n);
+ n
+ },
+ BatchSize::SmallInput,
+ ));
+ group.bench_function("merge_k_nearest_within", |b| b.iter_batched(
+ || Vec::with_capacity(3),
+ |mut n| {
+ index.merge_k_nearest_within(&target, 3, &mut n, 0.1);
+ n
+ },
+ BatchSize::SmallInput,
+ ));
group.finish();
};