-
-
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: NDArrayBacked in cython #40054
PERF: NDArrayBacked in cython #40054
Conversation
does this change real world benchmarks by a non-trivial amount? |
havent run the asvs yet, have been asv-ing the crap out of another branch (which led to #40066) |
I think you could apply several of the "tricks" that you now do in cython also in the current python code to get some speed-up already without using cython (of course not as fast as with cython, but it can certainly improve compared to master, I think): add a Secondly, this mostly matters for tiny arrays. Doing your ndarray vs EA copy comparison from above with a larger array gives:
Which is not to say that micro-performance for small arrays cannot be important for certain use cases. But as Jeff says, I would first look for some more real-world uses cases where this matters, before considering using cython be worth the added complexity. |
good idea. ill give some of these a go. |
mothballing |
Context: looking at backing
DatetimeBlock
/TimedeltaBlock
byDatetimeArray
/TimedeltaArray
directly (as opposed to the status quo where we back by ndarrays) and profiling, the constructors stand out as a major source of overhead.Idea: put the ndarray-wrapping methods in cython
Upsides: performance! stats currently pasted into the NDArrayBacked docstring:
i.e.
dta.copy()
is 3x faster, and within 2x of numpy. With further tweaks we could get within 10% of numpy (the 328 ns number).dta.T
is 4x faster and within 2x of numpy.(T is more-improved than copy bc we override copy in python to copy
.freq
)Downsides: 1) pickle is a PITA, 2) constructor gymnastics
Future:
__cinit__
; requires more constructor gymnatics