-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove cloning from geo iterators in trait (#278)
* wip: remove cloning from geo iterators in trait * On reference as well * Remove clone on geo access * add from_geo bench
- Loading branch information
1 parent
774b212
commit 9a0df7f
Showing
9 changed files
with
126 additions
and
57 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,34 @@ | ||
use geo::polygon; | ||
|
||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
use geoarrow::array::{MutablePolygonArray, PolygonArray}; | ||
|
||
fn create_data() -> Vec<geo::Polygon> { | ||
// An L shape | ||
// https://github.com/georust/geo/blob/7cb7d0ffa6bf1544c5ca9922bd06100c36f815d7/README.md?plain=1#L40 | ||
let poly = polygon![ | ||
(x: 0.0, y: 0.0), | ||
(x: 4.0, y: 0.0), | ||
(x: 4.0, y: 1.0), | ||
(x: 1.0, y: 1.0), | ||
(x: 1.0, y: 4.0), | ||
(x: 0.0, y: 4.0), | ||
(x: 0.0, y: 0.0), | ||
]; | ||
let v = vec![poly; 1000]; | ||
v | ||
} | ||
|
||
pub fn criterion_benchmark(c: &mut Criterion) { | ||
let data = create_data(); | ||
|
||
c.bench_function("convert Vec<geo::Polygon> to PolygonArray", |b| { | ||
b.iter(|| { | ||
let mut_arr = MutablePolygonArray::<i32>::from_polygons(&data, Default::default()); | ||
let _arr: PolygonArray<i32> = mut_arr.into(); | ||
}) | ||
}); | ||
} | ||
|
||
criterion_group!(benches, criterion_benchmark); | ||
criterion_main!(benches); |
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
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
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
Oops, something went wrong.