[Numpy-discussion] Ruby benchmark -- numpy is slower.... was: Re: Ruby's NMatrix and NVector

David Cournapeau david at ar.media.kyoto-u.ac.jp
Fri May 16 09:31:00 EDT 2008


Sebastian Haase wrote:
> Hi,
> can someone comment on these timing numbers ?
> http://narray.rubyforge.org/bench.html.en
>
> Is the current numpy faster ?
>   

It is hard to know without getting the same machine or having the 
benchmark sources. But except for add, all other operations rely on 
underlying blas/lapack (only matrix operations do if you have no cblas), 
so I am a bit surprised by the results.

FWIW, doing 100 x "c = a + b" with 1e6 elements on a PIV prescott @ 3.2 
Ghz is about 2 sec, and I count numpy start:

import numpy as np

a = np.random.randn(1e6)
b = np.random.randn(1e6)

for i in range(100):
    a + b

And np.dot(a, b) for 3 iterations and 500x500 takes 0.5 seconds (again 
taking into account numpy import), but what you really do here is 
benchmarking your underlying BLAS (if numpy.dot does use BLAS, again, 
which it does at least when built with ATLAS).

cheers,

David



More information about the NumPy-Discussion mailing list