[Numpy-discussion] fast_any_all , a trivial but fast/useful helper function for numpy

Chris Barker - NOAA Federal chris.barker at noaa.gov
Thu Sep 5 13:16:06 EDT 2013


This is good stuff, but I can't help thinking that if I needed to do an
any/all test on a number of arrays with common and/or combos --
I'd probably write a Cython function to do it.

It could be a bit tricky to make it really general, but not bad for a
couple specific dtypes / use cases.

-just a thought...

Also -- how does this work with numexpr? It would be nice if it could
handle these kinds of cases.

-Chris





On Thu, Sep 5, 2013 at 1:54 AM, Graeme B. Bell <grb at skogoglandskap.no>wrote:

>
>
> Hi Julian,
>
> Thanks for the post.  It's great to hear that the main numpy function is
> improving in 1.8, though I think there is still plenty of value here for
> performance junkies :-)
>
> I don't have 1.8beta installed (and I can't conveniently install it on my
> machines just now). If you have time, and have the beta installed, could
> you try this and mail me the output from the benchmark?  I'm curious to
> know.
>
> # git clone https://github.com/gbb/numpy-fast-any-all.git
> # cd numpy-fast-any-all
> # python test-fast-any-all.py
>
> Graeme
>
>
> On Sep 4, 2013, at 7:38 PM, Julian Taylor <jtaylor.debian at googlemail.com>
> wrote:
>
> >>
> >> The result is 14 to 17x faster than np.any() for this use case.*
> >
> > any/all and boolean operations have been significantly speed up by
> > vectorization in numpy 1.8 [0].
> > They are now around 10 times faster than before, especially if the
> > boolean array fits into one of the cpu caching layers.
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130905/b47a7113/attachment.html>


More information about the NumPy-Discussion mailing list