[Numpy-discussion] Boolean arrays
Fri Aug 27 16:55:33 CDT 2010
On Fri, Aug 27, 2010 at 1:35 PM, Robert Kern <firstname.lastname@example.org> wrote:
> |8> %timeit kern_in(ar, valid)
> 10 loops, best of 3: 115 ms per loop
> |9> %timeit np.in1d(ar, valid)
> 1 loops, best of 3: 279 ms per loop
> As valid gets larger, in1d() will catch up but for smallish sizes of
> valid, which I suspect given the "non-numeric" nature of the OP's (Hi,
> Brett!) request, kern_in() is usually better.
Oh well, I was just guessing based on algorithmic properties. Sounds
like there might be some optimizations possible to in1d then, if
anyone had a reason to care :-).
More information about the NumPy-Discussion