-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
944: Add WindingOrder benchmark r=lnicola a=frewsxcv - [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/main/CODE_OF_CONDUCT.md). - [ ] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users. --- Co-authored-by: Corey Farwell <coreyf@rwell.org>
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#[macro_use] | ||
extern crate criterion; | ||
extern crate geo; | ||
|
||
use geo::prelude::*; | ||
|
||
fn criterion_benchmark(c: &mut criterion::Criterion) { | ||
c.bench_function("winding order: winding_order (f32)", |bencher| { | ||
let ls = geo_test_fixtures::louisiana::<f32>(); | ||
|
||
bencher.iter(|| { | ||
let _ = criterion::black_box(criterion::black_box(&ls).winding_order()); | ||
}); | ||
}); | ||
|
||
c.bench_function("winding order: winding_order (f64)", |bencher| { | ||
let ls = geo_test_fixtures::louisiana::<f64>(); | ||
|
||
bencher.iter(|| { | ||
let _ = criterion::black_box(criterion::black_box(&ls).winding_order()); | ||
}); | ||
}); | ||
|
||
c.bench_function("winding order: points_cw (f32)", |bencher| { | ||
let ls = geo_test_fixtures::louisiana::<f32>(); | ||
|
||
bencher.iter(|| { | ||
let points_iter = criterion::black_box(criterion::black_box(&ls).points_cw()); | ||
for point in points_iter { | ||
criterion::black_box(point); | ||
} | ||
}); | ||
}); | ||
|
||
c.bench_function("winding order: points_cw (f64)", |bencher| { | ||
let ls = geo_test_fixtures::louisiana::<f64>(); | ||
|
||
bencher.iter(|| { | ||
let points_iter = criterion::black_box(criterion::black_box(&ls).points_cw()); | ||
for point in points_iter { | ||
criterion::black_box(point); | ||
} | ||
}); | ||
}); | ||
|
||
c.bench_function("winding order: points_ccw (f32)", |bencher| { | ||
let ls = geo_test_fixtures::louisiana::<f32>(); | ||
|
||
bencher.iter(|| { | ||
let points_iter = criterion::black_box(criterion::black_box(&ls).points_ccw()); | ||
for point in points_iter { | ||
criterion::black_box(point); | ||
} | ||
}); | ||
}); | ||
|
||
c.bench_function("winding order: points_ccw (f64)", |bencher| { | ||
let ls = geo_test_fixtures::louisiana::<f64>(); | ||
|
||
bencher.iter(|| { | ||
let points_iter = criterion::black_box(criterion::black_box(&ls).points_ccw()); | ||
for point in points_iter { | ||
criterion::black_box(point); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
criterion_group!(benches, criterion_benchmark); | ||
criterion_main!(benches); |