NumPy 2.5 Delivers Up To 25x Performance Gains For np.searchsorted
The release of NumPy 2.5 introduces a C++ implementation of np.searchsorted that provides significant speed improvements over the previous version.
NumPy 2.5 brings speed increases of up to 25 times to np.searchsorted compared to NumPy 2.4.
The update started with a vectorized Python prototype. That initial code showed a vectorized approach could beat the existing native implementation.
After that success, the logic moved to C++ for the 2.5 release. The work also includes documentation with specific steps and direct comparisons between the new implementation and other common array libraries.
If you use np.searchsorted in your workflows, you get these performance gains by upgrading.
