[Numpy-discussion] Speed performance on array constant set

Christopher Barker Chris.Barker at noaa.gov
Fri Jan 20 09:36:09 CST 2006


Sasha wrote:

>>python -m timeit  -s "import numpy as na; a = na.zeros((1000,1000))" "a.fill(7)"

or use a += 7:

$ python2.4 -m timeit  -s "import numpy as na; a = 
na.zeros((1000,1000))" "a.fill(7)"

100 loops, best of 3: 6.95 msec per loop

$ python2.4 -m timeit  -s "import numpy as na; a = 
na.zeros((1000,1000))" "a += 7"

100 loops, best of 3: 3.24 msec per loop

A factor of 2 speedup for me. I don't know why fill is slower.


> So IPP gives me 3X, which leads me to ask about plans for IPP / SSE for 
> NumPy, no offense intended to non Intel users.

I"ve wondered about this as as well, though not necessarily  IPP / SEE. 
It seems that BLAS should provide some optimizations that could be used 
outside of the strictly linear algebra functions, like element-wise 
multiplication, array copying, etc. However, I haven't looked into it, 
and I suppose it would make for a lot of special-case code.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (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




More information about the Numpy-discussion mailing list