[Numpy-discussion] How fast are small arrays currently?

David M. Cooke cookedm at physics.mcmaster.ca
Tue Jan 20 13:05:01 EST 2004


On Tue, Jan 20, 2004 at 03:38:34PM -0500, Perry Greenfield wrote:
> David M. Cooke writes:
> 
> > Just what I was doing :-)
> > 
> > Check out http://arbutus.mcmaster.ca/dmc/numpy/ for a graph comparing
> > the two.
> > 
> > Basically, I get on my machine (a 1.3 GHz Athlon running Linux), for an
> > array of size N (of Float), the time to do a+a is
> > 
> > Numeric:  3.7940e-6 + 2.2556e-8 * N seconds
> > numarray: 3.7062e-5 + 5.8497e-9 * N
> > 
> > For sin(a), 
> > Numeric:  1.7824e-6 + 1.1341e-7 * N
> > numarray: 2.8994e-5 + 9.8985e-8 * N
...
> How many times do you do the operation for each size? Because of
> caching, the first result may be much slower than the rest.
> If you didn't could you try computing it by discarding the first
> numarray time (or start timing after doing the first iteration)?

10000 times per size. I'm re-running it like you suggested, but the
difference is small (the new version is up on the above page). For
numarray for addition, it's now
3.8771e-5 + 4.9832e-9 * N

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca




More information about the NumPy-Discussion mailing list