Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cached envelope for polygon-polygon euclidean distance #1093

Merged
merged 5 commits into from
Oct 18, 2023

Conversation

urschrei
Copy link
Member

  • I agree to follow the project's code of conduct.
  • I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

Results in an 11 % - 14 % speedup on my machine

@@ -585,8 +586,18 @@ pub fn nearest_neighbour_distance<T>(geom1: &LineString<T>, geom2: &LineString<T
where
T: GeoFloat + RTreeNum,
{
let tree_a: RTree<Line<_>> = RTree::bulk_load(geom1.lines().collect::<Vec<_>>());
let tree_b: RTree<Line<_>> = RTree::bulk_load(geom2.lines().collect::<Vec<_>>());
let tree_a: RTree<CachedEnvelope<Line<_>>> = RTree::bulk_load(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let tree_a: RTree<CachedEnvelope<Line<_>>> = RTree::bulk_load(
let tree_a = RTree::bulk_load(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like type inference also improved sometime around 2017

Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
geom2
.lines()
.map(CachedEnvelope::new)
.collect::<Vec<_>>(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.collect::<Vec<_>>(),
.collect::<Vec<_>>(),

@lnicola lnicola enabled auto-merge October 18, 2023 13:24
@lnicola lnicola added this pull request to the merge queue Oct 18, 2023
Merged via the queue into georust:main with commit 16b2d05 Oct 18, 2023
@urschrei urschrei deleted the polydistenvelope branch October 18, 2023 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants