-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
PERF: better use of searchsorted for indexing performance #14565
Comments
I've been playing around with your original speedup:
And I noticed that normally
And then call
|
@mroeschke That seems to make sense, yes. Do you know if there are many occurrences of the use of |
Sorry for the delay in response @jorisvandenbossche. Reviewing where There are four occurrences in this block that speeds up Two more in this block (not sure of the performance use case, but similar code path to your original fix): And I believe one on the So maybe a private helper function in Also I saw that there's a |
+1 The
I would first focus on the internal use cases. In those cases, you would need a bit more checking, as you can in principle pass a float to a searchsorted of ints, and doing a |
In the meantime, I think this has been fixed in the deprecation panel PR by @jreback (see discussion here: #15601 (comment), and this commit: c39453a) So basically the approach of having a FrozenNDArray searchsorted method to handle this as proposed above |
Would be good to still do the second point in the original issue here: add benchmarks for the affected cases. |
@jreback @jorisvandenbossche @mroeschke : I'm planning to deprecate Not to mention, the performance optimization for Given that |
Follow-up on #14551
When searchsorted is used (eg as
labels.searchsorted(loc)
), it is important thatloc
is first cast to the same dtype aslabels
for performance reasons.PR #14551 fixed one such example, but further actions:
searchsorted
for this patternThe text was updated successfully, but these errors were encountered: