-
Notifications
You must be signed in to change notification settings - Fork 1.5k
ENH: Optimize getting named destinations #3442
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
base: main
Are you sure you want to change the base?
Conversation
96cb457
to
ae6835f
Compare
@stefan6419846 I need some help with this. ruff and Python both are complaining about |
Please try to rebase on the latest main - your base appears to be outdated and the corresponding import is gone in main. |
5f25cc9
to
2c3fb66
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3442 +/- ##
=======================================
Coverage 96.97% 96.98%
=======================================
Files 54 54
Lines 9337 9344 +7
Branches 1711 1713 +2
=======================================
+ Hits 9055 9062 +7
Misses 168 168
Partials 114 114 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
That worked. Thank you! The PR should be ready now. |
Thanks for the PR. This code seems to assume that the named destinations never change. Is this really a valid assumption or will this create unexpected behavior in specific cases? |
It does assume the destinations never change. Originally I put this cache on the shared superclass for readers and writers, but then had the same realization as you. So now this code is only in the |
Thanks for the explanation - indeed, in the reader it should not be an issue. Are we able to add a test for this? |
Hmmm. What sort of tests are you looking for? Tests of changing the named destinations in the reader? I guess not, since that's not supposed to be possible. Tests of changing the named destinations in the writer? It doesn't use this code, but I guess I could add. Or just tests of reading named destinations at all? Those might already exist for all I know, but I could check, once I know what you're thinking. |
Sorry for not being explicit enough - I am referring to the fact that these are cached. One possible approach would be to check the time for handling many destinations the first and the second time, although I am open for other tests as well. |
This optimization solves the performance issue introduced by PR #3400.
Without this optimization
test_merger.py
takes 124 seconds on my laptop after PR 3400. With this optimization it takes 6.6 seconds.Very likely this optimization will benefit other code as well.