-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
281: Add benchmark for 'extremes' algorithms. r=frewsxcv a=frewsxcv Co-authored-by: Corey Farwell <[email protected]>
- Loading branch information
Showing
2 changed files
with
34 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,30 @@ | ||
#[macro_use] | ||
extern crate criterion; | ||
extern crate geo; | ||
|
||
use criterion::Criterion; | ||
use geo::{LineString, Polygon}; | ||
use geo::prelude::*; | ||
|
||
fn criterion_benchmark(c: &mut Criterion) { | ||
c.bench_function("extremes f32", |bencher| { | ||
let points = include!("../src/algorithm/test_fixtures/norway_main.rs"); | ||
let polygon = Polygon::new(LineString::<f32>::from(points), vec![]); | ||
|
||
bencher.iter(|| { | ||
polygon.extreme_points(); | ||
}); | ||
}); | ||
|
||
c.bench_function("extremes f64", |bencher| { | ||
let points = include!("../src/algorithm/test_fixtures/norway_main.rs"); | ||
let polygon = Polygon::new(LineString::<f32>::from(points), vec![]); | ||
|
||
bencher.iter(|| { | ||
polygon.extreme_points(); | ||
}); | ||
}); | ||
} | ||
|
||
criterion_group!(benches, criterion_benchmark); | ||
criterion_main!(benches); |