Re: [Numpy-discussion] Is sum() slow?
by Sasha other posts by this author
Mar 8 2006 7:33PM messages near this date
Re: [Numpy-discussion] Is sum() slow?
|
Re: [Numpy-discussion] Is sum() slow?
On 3/7/06, Travis Oliphant <oliphant@[...].edu> wrote:
> ...
> I'm a little surprised that Numeric is so much faster for this case as
> you show later.
>
Here is another puzzle:
> python -m timeit -s "from Numeric import zeros,sum; x = zeros((2,500),'f')" "sum(x,0)"
100000 loops, best of 3: 6.05 usec per loop
> python -m timeit -s "from Numeric import zeros,sum; x = zeros((500,2),'f')" "sum(x,1)"
10000 loops, best of 3: 26.8 usec per loop
> python -m timeit -s "from numpy import zeros; x = zeros((2,500),'f')" "x.sum(0)"
10000 loops, best of 3: 22.8 usec per loop
> python -m timeit -s "from numpy import zeros; x = zeros((500,2),'f')" "x.sum(1)"
10000 loops, best of 3: 23.6 usec per loop
Numpy and Numeric perform very similarly when reducing along the second axis.
> If anyone can figure out how to make the NOBUFFER secion in
> GenericReduce faster in ufuncobject.c it will be greatly welcomed.
Here is my $.02:
<http://projects.scipy.org/scipy/numpy/wiki/PossibleOptimizationAreas/ReduceDiscussion>
BTW, I've tried to take loop-> ... redirections out of the loop: no
effect with gcc -O3 .
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@[...].net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Thread:
Mads Ipsen
Travis Oliphant
Sasha
Alexander Belopolsky
|