fix benchmarks
up to 20 recursive fibo had mixed add and calls for rubyx
This commit is contained in:
parent
6273ab769c
commit
8eb0ba0d81
@ -10,9 +10,9 @@ int fibo_r(int n)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int counter = 100000;
|
||||
int counter = 1000;
|
||||
int fib ;
|
||||
while(counter--) {
|
||||
fib += fibo_r(10);
|
||||
fib += fibo_r(20);
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ func fib(n uint) uint {
|
||||
|
||||
func main() {
|
||||
sum := 1
|
||||
for sum < 100000 {
|
||||
for sum < 1000 {
|
||||
sum += 1
|
||||
fib( 10 )
|
||||
fib( 20 )
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
hello - output hello world to measure kernel calls
|
||||
add - run integer adds by linear fibonacci of 20
|
||||
call - exercise calling by recursive fibonacci of 10
|
||||
call - exercise calling by recursive fibonacci of 20
|
||||
noop - a baseline that does nothing
|
||||
|
||||
All programs (apart from noop) run 100k times to minimize startup impact.
|
||||
Hello and add run 100k times, calls 1k, 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.
|
||||
@ -22,8 +22,8 @@ Results (in ms) should be seen as relative, not absolute.
|
||||
|
||||
|
||||
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
|
||||
c | 45 | 3480 | 150 | 1400
|
||||
go | 53 | 4000 | 64 | 740
|
||||
rubyx | 43 | 1560 | 1800 | 16500
|
||||
ruby | 1570 | 8240 | 2290 | 17800
|
||||
mruby | 86 | 11210 | 1580 | 26500
|
||||
|
@ -8,9 +8,9 @@ def fibo_r( n )
|
||||
end
|
||||
|
||||
|
||||
counter = 10000
|
||||
counter = 100
|
||||
|
||||
while(counter > 0) do
|
||||
fibo_r(10)
|
||||
fibo_r(20)
|
||||
counter -= 1
|
||||
end
|
||||
|
@ -1,19 +1,22 @@
|
||||
class Space
|
||||
|
||||
def fibo_i(fib)
|
||||
n = fib
|
||||
a = 0
|
||||
b = fib
|
||||
while( a < b )
|
||||
a = a + 1
|
||||
b = b - 1
|
||||
b = 1
|
||||
i = 1
|
||||
while( i < n )
|
||||
result = a + b
|
||||
a = b
|
||||
b = result
|
||||
i = i + 1
|
||||
end
|
||||
return a
|
||||
return result
|
||||
end
|
||||
|
||||
# ran with --parfait=100000
|
||||
# (time - noop) * 25 + noop
|
||||
# ran with --parfait=40000
|
||||
def main(arg)
|
||||
b = 4000
|
||||
b = 1000
|
||||
while( b >= 1 )
|
||||
b = b - 1
|
||||
fibo_i(20)
|
||||
|
@ -1,27 +1,22 @@
|
||||
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
|
||||
def fibo_r( n )
|
||||
if( n < 2 )
|
||||
return n
|
||||
end
|
||||
a = fibo_r(n - 1)
|
||||
d = fibo_r(n - 2)
|
||||
return a + d
|
||||
end
|
||||
|
||||
# ran with --parfait=80000
|
||||
# (time - noop) * 50 + noop
|
||||
# ran with --parfait=70000
|
||||
def main(arg)
|
||||
b = 2000
|
||||
b = 2
|
||||
res = 0
|
||||
while( b >= 1 )
|
||||
b = b - 1
|
||||
fibo_r(20)
|
||||
res = fibo_r(20)
|
||||
end
|
||||
return b
|
||||
return res
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user