Skip to content

Tentative Benchmark

Masahiro TANAKA edited this page May 31, 2017 · 1 revision
$ sh dbl.sh
array size = 100000
repeat = 10000
op: a+b
------------------
Python 2.7.5
numpy vesion 1.7.1
('time = ', 1.3463799953460693)
------------------
Python 3.6.1
numpy vesion  1.12.1
time =  1.0678894519805908
------------------
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
NArray version 0.6.1.2
time = 1.63268551
------------------
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
Numo::NArray version 0.9.0.7
time = 1.905221199
------------------
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
Numo::NArray working
time = 1.783795046
------------------
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
NMatrix version 0.2.3
time = 232.456422299

dbl.sh:

n=100000
m=10000
op="a+b"

echo "array size = $n"
echo "repeat = $m"
echo "op: $op"
echo ------------------

python --version
python <<EOF
N = $n
M = $m
import numpy as np
import time

print("numpy vesion "+np.__version__)

a = np.arange(N, dtype=np.float64)
b = np.arange(N, dtype=np.float64)
t = time.time()
for i in range(M):
    c = $op
print("time = ",time.time()-t);

EOF

echo ------------------

python3.6 --version
python3.6 <<EOF
N = $n
M = $m
import numpy as np
import time

print("numpy vesion ",np.__version__)

a = np.arange(N, dtype=np.float64)
b = np.arange(N, dtype=np.float64)
t = time.time()
for i in range(M):
    c = $op
print("time = ",time.time()-t);

EOF

echo ------------------

ruby --version
ruby <<EOF
require 'narray'
puts "NArray version #{NArray::NARRAY_VERSION}"

N = $n
M = $m

a = NArray.dfloat(N).indgen!
b = NArray.dfloat(N).indgen!
t = Time.now
M.times{|i| c = $op }
puts "time = #{Time.now - t}"
EOF

echo ------------------

ruby --version
ruby <<EOF
require 'numo/narray'
puts "Numo::NArray version #{Numo::NArray::VERSION}"

N = $n
M = $m

a = Numo::DFloat.new(N).seq
b = Numo::DFloat.new(N).seq
t = Time.now
M.times{|i| c = $op }
puts "time = #{Time.now - t}"
EOF

echo ------------------

ruby --version
ruby <<EOF
require '../narray/ext/numo/narray/narray.so'
require '../narray/lib/numo/narray/extra.rb'
puts "Numo::NArray working"

N = $n
M = $m

a = Numo::DFloat.new(N).seq
b = Numo::DFloat.new(N).seq
t = Time.now
M.times{|i| c = $op }
puts "time = #{Time.now - t}"
EOF

echo ------------------

ruby --version
ruby <<EOF
require 'nmatrix'
puts "NMatrix version #{NMatrix::VERSION::STRING}"

n = $n
M = $m

a = NMatrix.seq([n], dtype: :float64)
b = NMatrix.seq([n], dtype: :float64)
t = Time.now
M.times{|i| c = $op }
puts "time = #{Time.now - t}"
EOF
Clone this wiki locally