-
-
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
optimize align for scalars at least #8350
Comments
Maybe it would be enough to refactor def reindex_all(self) -> None:
results = []
for obj, matching_indexes in zip(
self.objects, self.objects_matching_indexes
):
if any(self.reindex[k] for k in matching_indexes):
results.append(self._reindex_one(obj, matching_indexes))
else:
results.append(obj.copy(deep=self.copy))
self.results = tuple(results) |
It depends on the profiling results below |
Yes, thanks. |
I guess that in this case we could skip copying objects that don't need reindexing, but is it always safe or desirable? Do we have an option for this (or skip alignment altogether)? |
What happened?
Here's a simple rescaling calculation:
The profile for the last line shows 30% (!!!) time spent in
align
(reallyreindex_like
) except there's nothing to reindex when only scalars are involved!This is a small example inspired by a ML pipeline where this normalization is happening very many times in a tight loop.
cc @benbovy
What did you expect to happen?
A fast path for when no reindexing needs to happen.
The text was updated successfully, but these errors were encountered: