-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Actually make the fast code path return early for Aligner.align #7222
Conversation
The reason this is a separate merge request, is that I agree that this is more contentious as a change. However, I will argue that Using ripgrep you find that the only instances of Aligner exist internally:
|
hmm ok. it seems i can't blatently avoid the copy like that. |
This reverts commit b528234.
I think the rapid return, helps by about 40% is still pretty good. |
Thanks @hmaarrfk!
Yes definitely. I think we just forgot to add it.
The reason of using a class is mainly for better code readability and also so that it is easier to refactor later. The alignment logic is really complex with lots of intermediate objects that are created and/or used at various stages. Probably using functions with some custom containers would have achieved the same goal, to be fair. This part of Xarray internals still deserves to be improved, but that would be a lot of work especially for such a critical piece of code in Xarray. |
Agreed. I'll take the small wins where I can :D. Great! I think this will be a good addition with: #7223 (comment) |
nice work @hmaarrfk ! |
In relation to my other PR.
Without this PR

With the early return

Removing the frivolous copy (does not pass tests)
Code for benchmark
xref: #7221
whats-new.rst
api.rst