▲ 127 r/Python
Making np.searchsorted up to 25× Faster in NumPy 2.5
I spent some of my free time optimizing "np.searchsorted" and recently wrote a blog post about it.
The new implementation is up to 25× faster in NumPy 2.5. It started with a vectorized NumPy implementation in Python that outperforms NumPy 2.4's native implementation. Then I ported the approach to C++, which was included as part of the NumPy 2.5 release.
The post includes the optimization steps, benchmarks, and comparisons with other array libraries.
u/amcandio — 12 days ago