Created
September 3, 2009 07:34
-
-
Save brixen/180170 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fib(n) | |
return n if n < 2 | |
fib(n-1) + fib(n-2) | |
end | |
Benchmark.bm do |x| | |
x.report { fib 40 } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gauss:rubinius brian$ ruby -r benchmark fib.rb | |
user system total real | |
153.620000 0.360000 153.980000 (157.128205) | |
gauss:rubinius brian$ ruby1.9 -r benchmark fib.rb | |
user system total real | |
33.450000 0.100000 33.550000 ( 34.083818) | |
gauss:rubinius brian$ bin/rbx -r benchmark fib.rb | |
user system total real | |
27.729074 0.000000 27.729074 ( 27.729094) | |
gauss:rubinius brian$ bin/rbx -XJ -r benchmark fib.rb | |
user system total real | |
9.568518 0.000000 9.568518 ( 9.568531) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment