Repository navigation
Speed up to_raster() by pruning candidates by their own radii; create Grid.compute_face_radii() - #1825
Merged
Conversation
ASV BenchmarkingBenchmark Comparison ResultsBenchmarks that have improved:
Benchmarks that have stayed the same:
Benchmarks that have got worse:
|
to avoid regressions to performance in "only a few candidates per point" cases and in "only a few candidates total" cases.
Sevans711
marked this pull request as ready for review
October 14, 2026 15:16
dylannelson
requested changes
Oct 15, 2026
dylannelson
left a comment
Member
There was a problem hiding this comment.
Everything looks good on my end, speedup is seen and has been demonstrated multiple ways locally. One new warning that popped up on my end, but I'm not as certain about the cause, but commented about where it seems to be. Maybe of others can give some feedback. It seems like it's the same error seen here in #1358, NumbaPerformanceWarning, which was also solved recently in the other speedup PR.
it was adding unnecessary complexity and a NumbaPerformanceWarning, there was no need for it to be jitted since it was just taking a max(), now that _compute_face_radii() handles the looping through faces.
cmdupuis3
requested changes
Oct 27, 2026
and make corresponding comments more concise
cmdupuis3
self-requested a review
October 28, 2026 15:02
cmdupuis3
approved these changes
Oct 28, 2026
Member
|
The numba comment has been resolved and I see no other concerns. Speed up is present and all looks good. Thanks! |
dylannelson
approved these changes
Oct 28, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1807, closes #1808
Overview
For #1808, creates
Grid.compute_face_radii(), along withtest_face_radii()to test it (and also to testGrid.max_face_radius, which was previously not mentioned explicitly anywhere in the test suite).For #1807, creates
_cull_candidates_by_radius()and uses it inside_point_in_face_query()to efficiently drop any candidates whose face radius is small enough that there is no possible way for the target point to be contained inside the face. Also added some thresholds to avoid running this cull in cases where there are "not many" candidates in total or "not many" candidates per point (before adding these thresholds, various ASV benchmarks showed slowdowns).I believe there are no surprises / expansions of scope in here; all changes go directly towards addressing the original issues.
Expected Usage
PR Checklist
General
Testing & Benchmarking
Documentation and Examples
docs/api.rst; internal (private) function names start with an underscore (_)AI Disclosure
AI Usage: Claude and GitHub Copilot's inline code suggestions