Skip to content

Commit

Permalink
warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhooray committed Nov 30, 2024
1 parent 6789aaa commit e5a5494
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
extern crate criterion;
extern crate kdtree;
extern crate rand;

extern crate criterion;

use criterion::{criterion_group, criterion_main, Criterion};
use kdtree::distance::squared_euclidean;
use kdtree::KdTree;
Expand All @@ -19,8 +18,8 @@ fn bench_add_to_kdtree_with_1k_3d_points(c: &mut Criterion) {
for _ in 0..len {
points.push(rand_data());
}
for i in 0..points.len() {
kdtree.add(&points[i].0, points[i].1).unwrap();
for point in points.iter() {
kdtree.add(&point.0, point.1).unwrap();
}
c.bench_function("bench_add_to_kdtree_with_1k_3d_points", |b| {
b.iter(|| kdtree.add(&point.0, point.1).unwrap());
Expand All @@ -35,8 +34,8 @@ fn bench_nearest_from_kdtree_with_1k_3d_points(c: &mut Criterion) {
for _ in 0..len {
points.push(rand_data());
}
for i in 0..points.len() {
kdtree.add(&points[i].0, points[i].1).unwrap();
for point in points.iter() {
kdtree.add(&point.0, point.1).unwrap();
}
c.bench_function("bench_nearest_from_kdtree_with_1k_3d_points", |b| {
b.iter(|| kdtree.nearest(&point.0, 8, &squared_euclidean).unwrap());
Expand All @@ -51,10 +50,9 @@ fn bench_within_2k_data_01_radius(c: &mut Criterion) {
for _ in 0..len {
points.push(rand_data());
}
for i in 0..points.len() {
kdtree.add(&points[i].0, points[i].1).unwrap();
for point in points.iter() {
kdtree.add(&point.0, point.1).unwrap();
}

c.bench_function("bench_within_2k_data_01_radius", |b| {
b.iter(|| kdtree.within(&point.0, 0.1, &squared_euclidean).unwrap());
});
Expand All @@ -68,8 +66,8 @@ fn bench_within_2k_data_02_radius(c: &mut Criterion) {
for _ in 0..len {
points.push(rand_data());
}
for i in 0..points.len() {
kdtree.add(&points[i].0, points[i].1).unwrap();
for point in points.iter() {
kdtree.add(&point.0, point.1).unwrap();
}
c.bench_function("bench_within_2k_data_02_radius", |b| {
b.iter(|| kdtree.within(&point.0, 0.2, &squared_euclidean).unwrap());
Expand All @@ -84,8 +82,8 @@ fn bench_within_unsorted_2k_data_01_radius(c: &mut Criterion) {
for _ in 0..len {
points.push(rand_data());
}
for i in 0..points.len() {
kdtree.add(&points[i].0, points[i].1).unwrap();
for point in points.iter() {
kdtree.add(&point.0, point.1).unwrap();
}
c.bench_function("bench_within_unsorted_2k_data_01_radius", |b| {
b.iter(|| kdtree.within_unsorted(&point.0, 0.1, &squared_euclidean).unwrap());
Expand All @@ -100,8 +98,8 @@ fn bench_within_unsorted_2k_data_02_radius(c: &mut Criterion) {
for _ in 0..len {
points.push(rand_data());
}
for i in 0..points.len() {
kdtree.add(&points[i].0, points[i].1).unwrap();
for point in points.iter() {
kdtree.add(&point.0, point.1).unwrap();
}
c.bench_function("bench_within_unsorted_2k_data_02_radius", |b| {
b.iter(|| kdtree.within_unsorted(&point.0, 0.2, &squared_euclidean).unwrap());
Expand All @@ -116,8 +114,8 @@ fn bench_within_count_2k_data_01_radius(c: &mut Criterion) {
for _ in 0..len {
points.push(rand_data());
}
for i in 0..points.len() {
kdtree.add(&points[i].0, points[i].1).unwrap();
for point in points.iter() {
kdtree.add(&point.0, point.1).unwrap();
}
c.bench_function("bench_within_count_2k_data_01_radius", |b| {
b.iter(|| kdtree.within_count(&point.0, 0.1, &squared_euclidean).unwrap());
Expand All @@ -132,8 +130,8 @@ fn bench_within_count_2k_data_02_radius(c: &mut Criterion) {
for _ in 0..len {
points.push(rand_data());
}
for i in 0..points.len() {
kdtree.add(&points[i].0, points[i].1).unwrap();
for point in points.iter() {
kdtree.add(&point.0, point.1).unwrap();
}
c.bench_function("bench_within_count_2k_data_02_radius", |b| {
b.iter(|| kdtree.within_count(&point.0, 0.2, &squared_euclidean).unwrap());
Expand Down

0 comments on commit e5a5494

Please sign in to comment.