-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
PERF: only apply nanops rowwise optimization for narrow arrows #44566
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
Conversation
pandas/core/nanops.py
Outdated
@@ -463,6 +463,7 @@ def newfunc(values: np.ndarray, *, axis: int | None = None, **kwargs): | |||
axis == 1 | |||
and values.ndim == 2 | |||
and values.flags["C_CONTIGUOUS"] | |||
and (values.shape[1] / values.shape[0]) > 1000 |
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.
can you add some comments about why these things are needed (e.g. for performance), can ref this issue as well.
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.
Added a comment with reference to my timings and update the docstring
Verified that the remaining failure is only an unrelated ResourceWarning |
thanks @jorisvandenbossche |
LGTM. merits an asv? |
It gave a huge slowdown in the current ASVs when running with ArrayManager, so in that way it's already captured. We could add one for wide dataframes as well, |
id be more comfortable with one that always runs |
See the timings in #43311 (comment)
(this is a regression compared to previous release mostly when using ArrayManager (and thus doesn't need a whatsnew) and is covered by the FrameOps benchmarks)