← Sunday, October 11, 2026Performance & OSDeep dive

NumPy 2.5 speeds up `searchsorted` by up to 25×

blog.scientific-python.org 15 min read Editor score 8/10

A vectorized binary-search formulation was ported into NumPy 2.5 and measured at up to 25× faster than NumPy 2.4. The techniques may also inform performance work in scientific Python libraries that depend on search operations.

What
NumPy 2.5 includes a vectorized `searchsorted` implementation for batched queries against a static sorted array.
How
It tracks each search’s `lo` and `hi` in arrays and updates them together with NumPy operations, avoiding sequential Python searches.
Why it matters
The change achieved up to a 25× benchmark speedup and can benefit scientific libraries that use `searchsorted`.
compare values update search… insertion pos… sorted array query keys lo and hi res
The vectorized binary search combines a sorted array and query keys to produce insertion positions. Sketched from the article's own text.

Discussion

Discussion is not switched on yet. Use Note above to keep your own thoughts on this story.

Headline, summary, brief and diagram are written by a model from the source's own text; the link, byline and numbers come from the source. Read the original before relying on a claim.

Your note

Private to you. Stored in this browser, and synced to your account when you are signed in.