-
-
Notifications
You must be signed in to change notification settings - Fork 26k
MAINT Remove get_memview_* helpers in KDTree & BallTree #15097
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
@@ -1322,7 +1258,7 @@ cdef class BinaryTree: | |||
|
|||
# flatten X, and save original shape information | |||
np_Xarr = X.reshape((-1, self.data.shape[1])) | |||
cdef DTYPE_t[:, ::1] Xarr = get_memview_DTYPE_2D(np_Xarr) | |||
cdef const DTYPE_t[:, ::1] Xarr = np_Xarr |
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.
Input array can be read-only, in which case setting it to a non const
memoryview would fail.
Do we get some unintended speed degradation here? Could you maybe make sure there are no odd python interactions after the change? |
I did benchmarks at the time, that showed no significant performance cost, but can't find them anymore. I'm waiting for official ASV benchmarks to be added #16723 so we have an official reference point. |
@rth : are you still interested in pursuing this PR? 🙂 |
@jjerphan Feel free to continue it in a separate PR and ping me for review :) I think the only thing remaining was to resolve conflicts and run some benchmarks to confirm. |
Thanks for the quick reply! |
The
get_memview_*
Cython helpers in KDTree and BallTree were used because at the time numpy/Cython didn't fully support memoryviews and now can be removed.This was adapted from larsmans's refactoring PR in #4217