[Numpy-discussion] ENH: Type specific binary search functions for `searchsorted`

Jaime Fernández del Río jaime.frio at gmail.com
Thu Jan 30 02:38:42 EST 2014


I have just added a new PR: https://github.com/numpy/numpy/pull/4244

>From the commit message:

This PR replaces the generic binary search functions used by `searchsorted`
with type specific ones for numeric types. This results in a speed-up of
calls to `searchsorted` which is highly dependent on the size of the
'haystack' and the 'needle', with typical values for large enough needles
in the 1.5x - 3.0x for direct searches (i.e. without a sorter argument)
and 1.2x - 2.0x for indirect searches. A summary benchmark on float and
int arrays can be found here.

Furthermore, the type specific binary search functions can take strided
inputs for all their arguments, which is a step in the right direction to
eventually add an axis argument to`searchsorted`.

Any comments and reviews are more than welcome!


( O.o)
( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes
de dominación mundial.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140129/5187165d/attachment.html>

More information about the NumPy-Discussion mailing list