Created
June 5, 2014 08:45
-
-
Save tak1n/a5236394137ad0a58118 to your computer and use it in GitHub Desktop.
Ruby Fibonacci "Benchmark"
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) | |
if n == 0 || n == 1 | |
n | |
else | |
fib(n-1) + fib(n-2) | |
end | |
end | |
36.times do |i| | |
puts "n=#{i} => #{fib(i)}" | |
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
Ruby HEAD - 7,36s user 0,02s system 99% cpu 7,390 total | |
Ruby 2.1.2 - 7,09s user 0,02s system 99% cpu 7,122 total | |
Ruby 2.1.1 - 7,02s user 0,01s system 99% cpu 7,049 total | |
Ruby 2.0.0 - 7,43s user 0,02s system 99% cpu 7,470 total | |
Ruby 1.9.3 - 10,75s user 0,02s system 99% cpu 10,787 total | |
Rubinius 2.2.7 - 2,50s user 0,05s system 106% cpu 2,388 total | |
Jruby 1.7.12 - 7,95s user 0,16s system 156% cpu 5,177 total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment