redid the old benchmarks

With #26 out of the way, was able to get meaningful rubyx benchmarks. Meaning loops large enough for the exec time to go significantly over the noop.
Did mruby too and as expected got much lower noop
This commit is contained in:
Torsten 2019-07-30 13:55:29 +03:00
parent ab87806d08
commit 6273ab769c
8 changed files with 68 additions and 13 deletions

View File

@ -2,6 +2,7 @@
int main(void)
{
setbuf(stdout, NULL); /* to make it equivalent to the other versions, otherwise it caches */
int counter = 100000;
while(counter--) {
printf("Hello there\n");

View File

@ -7,8 +7,10 @@ noop - a baseline that does nothing
All programs (apart from noop) run 100k times to minimize startup impact.
C was linked statically as dynamic linked influences times. Output was sent to /dev/null, so as
to measure the calling and not the terminal.
C was linked statically as dynamic linked influences times.
Output was sent to /dev/null, so as to measure the calling and not the terminal.
Also output was unbuffered, because that is what rubyx implements.
# Results
Results were measured by a ruby script. Mean and variance was measured until variance was low,
@ -16,14 +18,12 @@ always under one percent. Noop showed that program startup is a factor, so all p
to 100k.
The machine was a virtual arm (qemu) run on a acer swift 5 (i5 8265 3.9GHz), performance roughly equivalent to a raspberry pi.
But results (in ms) should be seen as relative, not absolute.
Results (in ms) should be seen as relative, not absolute.
language | noop | hello | add | call
c | 45 | 100 | 72 | 591
go | 53 | 4060 | 64 | 624
rubyx | 42 | 1245 | ????? | ????
ruby | 1830 | 2750 | 3000 | 1900_000
Comparison with ruby, not really for speed, just to see how much leeway there is in the future.
c | 45 | 3480 | 72 | 591
go | 53 | 4000 | 64 | 624
rubyx | 47 | 1660 | 800 | 2000
ruby | 1570 | 8240 | 2700 | 12370
mruby | 108 | 11210 | 1580 | 23400

View File

@ -8,7 +8,7 @@ def fibo_r( n )
end
counter = 100
counter = 10000
while(counter > 0) do
fibo_r(10)

View File

@ -2,5 +2,7 @@
counter = 100000;
while(counter > 0) do
puts "Hello there"
# roughly 4 times slower with this, which is like rubyx
#STDOUT.flush
counter = counter - 1
end

23
test/bench/rubyx/adds.rb Normal file
View File

@ -0,0 +1,23 @@
class Space
def fibo_i(fib)
a = 0
b = fib
while( a < b )
a = a + 1
b = b - 1
end
return a
end
# ran with --parfait=100000
# (time - noop) * 25 + noop
def main(arg)
b = 4000
while( b >= 1 )
b = b - 1
fibo_i(20)
end
return b
end
end

27
test/bench/rubyx/calls.rb Normal file
View File

@ -0,0 +1,27 @@
class Space
def fibo_r(fib)
n = fib
a = 0
b = 1
i = 1
while( i < n )
result = a + b
a = b
b = result
i = i + 1
end
return result
end
# ran with --parfait=80000
# (time - noop) * 50 + noop
def main(arg)
b = 2000
while( b >= 1 )
b = b - 1
fibo_r(20)
end
return b
end
end

View File

@ -1,6 +1,8 @@
class Space
# ran with --parfait=25000
# time - noop * 10 + noop
def main(arg)
b = 2*1000
b = 10000
while( b >= 1 )
b = b - 1
"Hello-there\n".putstring