add ruby bench programs and numbers

This commit is contained in:
Torsten Ruger 2015-11-24 15:33:16 +02:00
parent 535757fa98
commit fa63c6db6a
10 changed files with 62 additions and 3 deletions

View File

@ -25,7 +25,11 @@ language | loop | hello | itos | add | call
c | 0,0500 | 2,1365 | 0,2902 | 0,1245 | 0,8535
soml | 0,0374 | 1,2071 | 0,7263 | 0,2247 | 1,3625
ratio | 1,3368 | 1,7699 | 0,3996 | 0,5541 | 0,6264
| 0,7480 | 0,5650 | 2,5028 | 1,8048 | 1,5964
ruby | 0,3 | 8.882 | 0,8971 | 3,8452
2c | - 33 % | - 79 % | + 150% | + 80 % | + 60 %
2r | x 10 | x 6 | + 23% | x 17 | x 26
Comparison with ruby, not really for speed, just to see how much leeway there is for our next layer.
Ruby startup time is 1,5695 seconds, which we'll subtract from the benches

19
test/bench/ruby/adds.rb Normal file
View File

@ -0,0 +1,19 @@
def fibo( n)
a = 0
b = 1
i = 1
while( i < n ) do
result = a + b
a = b
b = result
i+= 1
end
return result
end
counter = 100000
while(counter > 0) do
fibo(40)
counter -= 1
end

16
test/bench/ruby/calls.rb Normal file
View File

@ -0,0 +1,16 @@
def fibo_r( n )
if( n < 2 )
return n
else
return fibo_r(n - 1) + fibo_r(n - 2)
end
end
counter = 1000
while(counter > 0) do
fibo_r(20)
counter -= 1
end

7
test/bench/ruby/hello.rb Normal file
View File

@ -0,0 +1,7 @@
counter = 100352 - 352;
while(counter > 0) do
puts "Hello there"
STDOUT.flush
counter = counter - 1
end

8
test/bench/ruby/itos.rb Normal file
View File

@ -0,0 +1,8 @@
counter = 100352 - 352
while(counter > 0) do
str = counter.to_s
counter = counter - 1
end
str

5
test/bench/ruby/loop.rb Normal file
View File

@ -0,0 +1,5 @@
counter = 100000
while(counter > 0) do
counter = counter - 1
end

View File

@ -23,7 +23,7 @@ end
class Runner
def initialize
@stats = Stats.new
@cmd = ARGV[0]
@cmd = ARGV.join(" ")
end
def run
while true