Skip to content

Commit

Permalink
Merge #281
Browse files Browse the repository at this point in the history
281: Add benchmark for 'extremes' algorithms. r=frewsxcv a=frewsxcv



Co-authored-by: Corey Farwell <[email protected]>
  • Loading branch information
bors[bot] and frewsxcv committed Jun 21, 2018
2 parents 0a48e70 + 9a2e6ea commit 57513bd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions geo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ harness = false
name = "vincenty_distance"
harness = false

[[bench]]
name = "extremes"
harness = false

[[bench]]
name = "euclidean_distance"
harness = false
Expand Down
30 changes: 30 additions & 0 deletions geo/benches/extremes.rs
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);

0 comments on commit 57513bd

Please sign in to comment.