-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
jit wrapped numpy sort & unique is more than 5x slower #9611
Comments
Issue Description Steps to Reproduce
Expected Behavior Actual Behavior Environment Information |
In the minimal example you have given, the time you are reporting includes the time taken to compile the code. |
I know that jit compiled code will be slower the first few times it runs, and I took that into account in my testing. In fact, the execution time given above is after the 3rd call to the function |
numpy 2.0.0 release seems to have optimized sorting significantly, perhaps numba needs some changes to go along with this update? |
@game-difficulty thank you for reporting this. From memory: there are duplicates to this on the issue tracker, it might be worth a look. IIRC |
I see. But I believe numba 0.60 needs to do something to follow up on numpy 2.0's optimization of sorting |
The way Numba works is that all NumPy functions are reimplemented in pure python so they can be compiled. Essentially someone will need to look at the Numba implementation of the numpy sorting function. This will not happen unless someone from the community volunteers and fixes it. Everyone realizes this is an important use-case, so polished contributions are very likely to attract reviewer attention. |
FWIW: the sorting code to be able to compile https://github.com/numba/numba/blob/main/numba/np/arrayobj.py#L6364 Hope that helps! |
example:
@numba.njit
def jit_sort(arr):
return np.sort(arr)
vs
np.sort(arr)
The text was updated successfully, but these errors were encountered: