diff --git a/test/bench/c/hello.c b/test/bench/c/hello.c index f3323d27..db6e3af4 100644 --- a/test/bench/c/hello.c +++ b/test/bench/c/hello.c @@ -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"); diff --git a/test/bench/results.md b/test/bench/results.md index f1e7f513..74339043 100644 --- a/test/bench/results.md +++ b/test/bench/results.md @@ -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. +language | noop | hello | add | call +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 diff --git a/test/bench/ruby/calls.rb b/test/bench/ruby/calls.rb index 3ba39352..93a16379 100644 --- a/test/bench/ruby/calls.rb +++ b/test/bench/ruby/calls.rb @@ -8,7 +8,7 @@ def fibo_r( n ) end - counter = 100 + counter = 10000 while(counter > 0) do fibo_r(10) diff --git a/test/bench/ruby/hello.rb b/test/bench/ruby/hello.rb index d730117a..5ff16636 100644 --- a/test/bench/ruby/hello.rb +++ b/test/bench/ruby/hello.rb @@ -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 diff --git a/test/bench/rubyx/adds.rb b/test/bench/rubyx/adds.rb new file mode 100644 index 00000000..e293e95a --- /dev/null +++ b/test/bench/rubyx/adds.rb @@ -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 diff --git a/test/bench/rubyx/calls.rb b/test/bench/rubyx/calls.rb new file mode 100644 index 00000000..813d1ef5 --- /dev/null +++ b/test/bench/rubyx/calls.rb @@ -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 diff --git a/test/bench/rubyx/hello.rb b/test/bench/rubyx/hello.rb index 1bd387fd..360dd808 100644 --- a/test/bench/rubyx/hello.rb +++ b/test/bench/rubyx/hello.rb @@ -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 diff --git a/test_interpreter_platform.rb b/test_interpreter_platform.rb deleted file mode 100644 index e69de29b..00000000