-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
PERF: avoid object-dtype comparisons #24792
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
Codecov Report
@@ Coverage Diff @@
## master #24792 +/- ##
==========================================
- Coverage 92.38% 92.38% -0.01%
==========================================
Files 166 166
Lines 52375 52382 +7
==========================================
+ Hits 48389 48394 +5
- Misses 3986 3988 +2
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #24792 +/- ##
==========================================
- Coverage 92.38% 92.38% -0.01%
==========================================
Files 166 166
Lines 52375 52382 +7
==========================================
+ Hits 48389 48394 +5
- Misses 3986 3988 +2
Continue to review full report at Codecov.
|
@@ -2465,6 +2465,12 @@ def setitem(self, indexer, value): | |||
klass=ObjectBlock,) | |||
return newb.setitem(indexer, value) | |||
|
|||
def equals(self, other): | |||
# override for significant performance improvement |
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.
why would u do this here and not in array_equivalent
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.
Because array_equivalent's docstring specifically says it assumes it is dealing with numpy arrays
thanks! |
Looking at the --durations=10 results in the tests, one that stands out is
It turns out all but about 0.15 seconds of this is spent in a
tm.assert_series_equal
call for a Datetime64TZ Series. Tracking that down, its in array_equivalent, which casts to object-dtype before comparing. This avoids that casting, shaves almost 7 seconds off that test.