2007年2月6日星期二

Comparison: XRuby, JRuby, Ruby, and Ruby with YARV

def fibonacci(n)

return n if n == 1 or n == 0

fibonacci(n - 1) + fibonacci(n - 2)

end

pre_time = Time.new.to_f

puts fibonacci(30)

puts Time.new.to_f - pre_time

azure@azure-windows /c/code/xruby

$ java -jar xruby-0.1.0.jar test.rb

832040

4.483999967575073

In New Runtime: around 2 seconds

Latest stable 1.8.5-p12

$ ./ruby.exe test.rb

832040

2.6560001373291

Older revision: 1.8.5 (build-2006-8-25), onclick install edition for win

$ ruby test.rb

832040

3.31200003623962

Lastest snapshot, 1.9.0 bundled with YARC

$ ./ruby.exe test.rb

832040

0.344000101089478

JRuby 0.9.2

C:\code\jruby-0.9.2\bin>jruby.bat test.rb

832040

19.0939998626709

没有评论: