-
-
Notifications
You must be signed in to change notification settings - Fork 860
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
perf: expose isPointInPolygon
and make 40% faster (at least in JIT mode)
#1907
Conversation
I mostly looked at the function because I wanted to use it myself but it was private. So I thought, if I expose it then I could at least put a ribbon on it by adding a benchmark. Before: (duration: 0:00:05.998949, name: In circle) (duration: 0:00:06.866919, name: Not in circle) After: (duration: 0:00:03.649496, name: In circle) (duration: 0:00:04.611599, name: Not in circle) Note, I opportunistically touched crs to remove the dart:ui dependency. This way it can be compiled with dart (w/o flutter) rendering the instructions in the benchmark correct again. Unfortunately, pointInPolygon is not so fortunate and needs flutter due to the dependency on ui.Offset. That's why I could only run it with "flutter test" in JIT mode.
isPointInPolygon
40% faster (at least in JIT mode)
isPointInPolygon
40% faster (at least in JIT mode)isPointInPolygon
and make 40% faster (at least in JIT mode)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, apart from one thing. Thanks!
In general in the past we've tried to avoid becoming a toolbox for these kinds of things, but seeing as we've recently exposed the simplification tools, I don't really have an issue this.
…point in hole" computation.
Sorry, I tagged on a bunch of other changes after looking a bit more at the implementation. Added a few comments. Hope it makes sense. |
…Polygon inputs. Would have caught previous misuse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks :)
I mostly looked at the function because I wanted to use it myself but it was private. So I thought, if I expose it then I could at least put a ribbon on it by adding a benchmark and make it go wroom.
Before:
(duration: 0:00:05.998949, name: In circle)
(duration: 0:00:06.866919, name: Not in circle)
After:
(duration: 0:00:03.649496, name: In circle)
(duration: 0:00:04.611599, name: Not in circle)
Note, I opportunistically touched crs to remove the dart:ui dependency. This way it can be compiled with dart (w/o flutter) rendering the instructions in the benchmark correct again. Unfortunately, pointInPolygon is not so fortunate and needs flutter due to the dependency on ui.Offset. That's why I could only run it with "flutter test" in JIT mode.