-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
45 additions
and
41 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,37 @@ | ||
#[macro_use] | ||
extern crate criterion; | ||
extern crate polylabel; | ||
|
||
use criterion::Criterion; | ||
use geo::Polygon; | ||
use polylabel::polylabel; | ||
|
||
fn criterion_benchmark(c: &mut Criterion) { | ||
c.bench_function("Threaded", |bencher| { | ||
// an L shape | ||
let coords = vec![ | ||
(0.0, 0.0), | ||
(4.0, 0.0), | ||
(4.0, 1.0), | ||
(1.0, 1.0), | ||
(1.0, 4.0), | ||
(0.0, 4.0), | ||
(0.0, 0.0), | ||
]; | ||
let poly = Polygon::new(coords.into(), vec![]); | ||
bencher.iter(|| { | ||
polylabel(&poly, &10.0); | ||
}); | ||
}); | ||
|
||
c.bench_function("Large Polygon", |bencher| { | ||
let points = include!("../data/norway_main.rs"); | ||
let poly = Polygon::new(points.into(), vec![]); | ||
bencher.iter(|| { | ||
polylabel(&poly, &1.0); | ||
}); | ||
}); | ||
} | ||
|
||
criterion_group!(benches, criterion_benchmark); | ||
criterion_main!(benches); |
This file was deleted.
Oops, something went wrong.
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