-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PERF: Sparse IntIndex.make_union / Numeric ops #13036
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
33104f5
to
8903da7
Compare
Current coverage is 84.06%@@ master #13036 diff @@
==========================================
Files 136 136
Lines 50005 49994 -11
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
- Hits 42040 42027 -13
- Misses 7965 7967 +2
Partials 0 0
|
this looks fine for 0.18.1. do you want to add some sparse benchmarks? |
a48f05d
to
d0034fe
Compare
d0034fe
to
b1cf4b5
Compare
OK, added whatsnew and bench.
|
|
||
# if is one already, returns self | ||
y = y_.to_int_index() | ||
|
||
if self.length != y.length: | ||
raise Exception('Indices must reference same underlying length') | ||
|
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.
not that I am recommending it, because the numpy code is just so much shorter. But this could have been much faster if the array was pre-allocated (to a max len), then you slice it at the end. Rather than appending using a list.
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.
Yeah will take suggested approach when I fix others using list.append
.
ok ping on green. |
Thanks, now green. |
thanks @sinhrks |
git diff upstream/master | flake8 --diff
Replace repeated
list.append
withnp.union1d
inIntIndex.make_union
.make_union
is used in numeric ops.NOTE: It is also possible to fix
IntIndex.intersect
to usenp.intersect1d
, but it doesn't increase the performance (because the length of the result is smaller).The below microbench assumes array's 90% is sparse.
on current master
After this PR