Take the New Ruby for a Spin

by Joey deVilla on November 28, 2007

Man on motorbike with beans by the handlebars and a large nozzle up his butt.
TURBOCHARGE! It’s assrockets all over again. What is it with people and sticking objects up their butts?

The real point to take from Antonio Cangiano’s article, Holy Shmoly, Ruby 1.9 smokes Python away!, is not that Ruby 1.9 runs circles around Python, but that Ruby 1.9′s performance appears to be dramatically better than Ruby 1.8′s.

Keep in mind that the article cites only one benchmark, a simple Fibonacci script:


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

On Cangiano’s machine, Ruby 1.8 took 159 seconds to run the script. Ruby 1.9 completed the task 13 times faster, clocking in at just under 12 seconds.

I’ll repeat what I said earlier: this is just one test. If you want to give Ruby 1.9 a proper performance shakedown, you’ll need to install it on your machine and compare its performance with Ruby 1.8 using a number of scripts. Luckily, the Ruby Inside blog has an article titled How to Start Playing with Ruby 1.9 Right Now! that provides easy instructions for acquiring and installing Ruby 1.9 in its own separate directory. I may just have to take 1.9 for a spin soon.

Links

Leave a Comment

Previous post:

Next post: