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 main(void)
|
||||||
{
|
{
|
||||||
int counter = 100000;
|
int counter = 1000;
|
||||||
int fib ;
|
int fib ;
|
||||||
while(counter--) {
|
while(counter--) {
|
||||||
fib += fibo_r(10);
|
fib += fibo_r(20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ func fib(n uint) uint {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
sum := 1
|
sum := 1
|
||||||
for sum < 100000 {
|
for sum < 1000 {
|
||||||
sum += 1
|
sum += 1
|
||||||
fib( 10 )
|
fib( 20 )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
hello - output hello world to measure kernel calls
|
hello - output hello world to measure kernel calls
|
||||||
add - run integer adds by linear fibonacci of 20
|
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
|
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.
|
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.
|
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
|
language | noop | hello | add | call
|
||||||
c | 45 | 3480 | 72 | 591
|
c | 45 | 3480 | 150 | 1400
|
||||||
go | 53 | 4000 | 64 | 624
|
go | 53 | 4000 | 64 | 740
|
||||||
rubyx | 47 | 1660 | 800 | 2000
|
rubyx | 43 | 1560 | 1800 | 16500
|
||||||
ruby | 1570 | 8240 | 2700 | 12370
|
ruby | 1570 | 8240 | 2290 | 17800
|
||||||
mruby | 108 | 11210 | 1580 | 23400
|
mruby | 86 | 11210 | 1580 | 26500
|
||||||
|
@ -8,9 +8,9 @@ def fibo_r( n )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
counter = 10000
|
counter = 100
|
||||||
|
|
||||||
while(counter > 0) do
|
while(counter > 0) do
|
||||||
fibo_r(10)
|
fibo_r(20)
|
||||||
counter -= 1
|
counter -= 1
|
||||||
end
|
end
|
||||||
|
@ -1,19 +1,22 @@
|
|||||||
class Space
|
class Space
|
||||||
|
|
||||||
def fibo_i(fib)
|
def fibo_i(fib)
|
||||||
|
n = fib
|
||||||
a = 0
|
a = 0
|
||||||
b = fib
|
b = 1
|
||||||
while( a < b )
|
i = 1
|
||||||
a = a + 1
|
while( i < n )
|
||||||
b = b - 1
|
result = a + b
|
||||||
|
a = b
|
||||||
|
b = result
|
||||||
|
i = i + 1
|
||||||
end
|
end
|
||||||
return a
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
# ran with --parfait=100000
|
# ran with --parfait=40000
|
||||||
# (time - noop) * 25 + noop
|
|
||||||
def main(arg)
|
def main(arg)
|
||||||
b = 4000
|
b = 1000
|
||||||
while( b >= 1 )
|
while( b >= 1 )
|
||||||
b = b - 1
|
b = b - 1
|
||||||
fibo_i(20)
|
fibo_i(20)
|
||||||
|
@ -1,27 +1,22 @@
|
|||||||
class Space
|
class Space
|
||||||
|
|
||||||
def fibo_r(fib)
|
def fibo_r( n )
|
||||||
n = fib
|
if( n < 2 )
|
||||||
a = 0
|
return n
|
||||||
b = 1
|
|
||||||
i = 1
|
|
||||||
while( i < n )
|
|
||||||
result = a + b
|
|
||||||
a = b
|
|
||||||
b = result
|
|
||||||
i = i + 1
|
|
||||||
end
|
end
|
||||||
return result
|
a = fibo_r(n - 1)
|
||||||
|
d = fibo_r(n - 2)
|
||||||
|
return a + d
|
||||||
end
|
end
|
||||||
|
|
||||||
# ran with --parfait=80000
|
# ran with --parfait=70000
|
||||||
# (time - noop) * 50 + noop
|
|
||||||
def main(arg)
|
def main(arg)
|
||||||
b = 2000
|
b = 2
|
||||||
|
res = 0
|
||||||
while( b >= 1 )
|
while( b >= 1 )
|
||||||
b = b - 1
|
b = b - 1
|
||||||
fibo_r(20)
|
res = fibo_r(20)
|
||||||
end
|
end
|
||||||
return b
|
return res
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user