-
Notifications
You must be signed in to change notification settings - Fork 214
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: Optimize for single point in Geod fwd/inv functions #1206
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1206 +/- ##
==========================================
- Coverage 96.28% 96.27% -0.01%
==========================================
Files 20 20
Lines 1803 1801 -2
==========================================
- Hits 1736 1734 -2
Misses 67 67
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Nice! I am starting to think that following this pattern in #1204 may make sense as well. |
53e20e8
to
b752dd9
Compare
I think it would be nice to add this pattern to the |
17d7bda
to
ce18874
Compare
This adds a fast-path for scalar inputs and falls back to the previous implementation if any inputs can't be cast to double.
ce18874
to
b93fedf
Compare
My main hesitation to merge is the amount of code added versus the amount of code tested. The tests you added are a good start. However, I am thinking it may be a good idea to update the |
Thanks @greglucas 👍 |
👍 Thanks, @snowman2! FYI that this all works really nicely over on Cartopy without any update needed to the code at all. The benchmark case I was running went from 7s on |
That's great 🎉 |
Thanks for doing all this @greglucas ! |
This adds a fast-path for scalar inputs by trying out a double-only implementation, and falling back if any input is not a double. An alternative is to add
Geod.fwd_point()
andGeod.inv_point()
functions as well, but I kind of like this transparent form for simplicity of users only needing one function and only a minor overhead for arrays where you are already going through some slower paths.A little under 10x improvement for scalars.