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

David Cournapeau cournape@gmail....
Fri May 16 10:39:56 CDT 2008


On Sat, May 17, 2008 at 12:00 AM, Anne Archibald
<peridot.faceted@gmail.com> wrote:

>
> There are four benchmarks: add, multiply, dot, and solve. dot and
> solve use BLAS, and for them numpy ruby and octave are comparable. Add
> and multiply are much slower in numpy, but they are implemented in
> numpy itself.

The benchmark was done in 2005, and we do not know how it was done (no
source). I don't know anything about ruby (that's my first ruby
"program") but:

cat > test1.py
require "narray"

a = NArray.float(1e6).fill(0)
b = NArray.float(1e6).fill(0)

for i in 1..200
        a + b
end
EOF

cat > test1.py
import numpy as np

a = np.zeros(1e6)
b = np.zeros(1e6)

for i in range(200):
        a + b
EOF

Give me extremely close results (now on my macbook with a core 2 duo).
One nice thing with narray is the speed when loading it (10 x faster),
but that may well be because narray is much smaller than numpy.

cheers,

David


More information about the Numpy-discussion mailing list