Back to Numpy

Improved performance of ``numpy.searchsorted``

doc/release/upcoming_changes/30517.performance.rst

2.5.0.dev0520 B
Original Source

Improved performance of numpy.searchsorted

The C++ binary search implementation used by numpy.searchsorted now has a much better performance when searching for multiple keys. The new implementation batches binary search steps across all keys to leverage cache locality and out-of-order execution. Benchmarks show the new implementation can be up to 20 times faster for hundreds of thousands keys while single-key performance remains comparable to previous versions.