[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.
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
> # git clone https://github.com/gbb/numpy-fast-any-all.git
> # cd numpy-fast-any-all
> # python test-fast-any-all.py
> On Sep 4, 2013, at 7:38 PM, Julian Taylor <jtaylor.debian at googlemail.com>
> >> 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 .
> > 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
Christopher Barker, Ph.D.
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...
More information about the NumPy-Discussion