In case you didn't know, a new virtual machine for Ruby called YARV (Yet Another Ruby VM) has been integrated into testing for Ruby 1.9.
In my own (very informal) testing, I've gotten speed ups of 2x to about 8x.
You can download it from the ruby-lang.org website.
Also, take a glance at this page for some benchmarks.
http://www.antoniocangiano.com/artic...us-vs-cardinal
EDIT: I thought I'd add a little example.
def fib(n)
if n < 3
1
else
fib(n - 1) + fib(n - 2)
end
end
fib(34)
def fib(n):
if n < 3:
return 1
else:
return fib(n - 1) + fib(n - 2)
fib(34)
Ruby 1.8.5
$ time ruby fib.rb
real 0m15.306s
user 0m13.273s
sys 0m1.984s
Python 2.4.4
$ time python fib.py
real 0m6.857s
user 0m6.736s
sys 0m0.036s
Ruby 1.9 (2007 - 02 - 25)
$ time /usr/local/src/ruby/ruby fib.rb
real 0m2.048s
user 0m2.012s
sys 0m0.016s