InfoQ

News

Ruby Performance: Great Shootout Results And A Discovery About Binary MRI vs Source Compiled MRI

Posted by Werner Schuster on Dec 11, 2008

Community
.NET,
Ruby,
Java
Topics
Dynamic Languages ,
JRuby ,
Runtimes ,
Performance & Scalability
Tags
Virtual Machines ,
Rubinius ,
IronRuby ,
Ruby1.9 ,
MagLev ,
JRuby

There is competition between the Ruby implementations, particularly in matters of performance. A year ago, Antonio Cangiano ran the Great Ruby Shootout, which compared 1.8.6, 1.9.0, JRuby, Rubinius as well as the Ruby.NET implementation, which has now been discontinued.

Now, Antonio published the Great Ruby Shootout 2008, which compares 1.8.6, 1.9.1, JRuby, Rubinius, Ruby Enterprise Edition, IronRuby as well as the latest addition, MagLev.

It's important to remember to always take benchmarks with a grain of salt, which was shown again when Antonio found problems with his initial run and published an updated version, which changed the result a bit. One of the problems he found was with the Ruby version available through Debian's package management system:

The really big, flashing warning though is what happens when you install Ruby through apt-get. Compiling from source gives you double the speed, according to these tests. I expected a 10/20% increase, not 100%. The gist of it is that prepackaged Ruby is compiled using the option --enable-pthreads and there is the whole issue of shared vs static libraries.


Prashant Srinivasan has previously mentioned the --enable-ptread issue and explains the reasons why it slows down the system.
The benchmark also shows that Ruby 1.8.x on Windows runs at about half the speed of a 1.8.7 (compiled from source) on Linux.

As for the the fastest, publically available Ruby implementation is now Ruby 1.9.1, followed closely by JRuby 1.1.6RC1. According to these benchmarks, JRuby seems to be the fastest way to execute Ruby 1.8.x code at the moment.

The other Ruby implementations, Rubinius and IronRuby still are mostly slower than MRI. MacRuby 0.3, which is based on Ruby 1.9, was slightly slower too - however, it's not deemed to be production ready yet, which should happen with one of the next releases (MacRuby 0.4 is expected to be out later this year).

The results of MagLev show promise, with many benchmarks running significantly faster then MRI, and a few running slower. To put this in perspective: MagLev is still a very young project, only started earlier this year.

Finally, an important point. The benchmark code used for the Great Ruby Shootout consists of many microbenchmarks, which tests individual features of Ruby and the Ruby runtimes. As Antonio explains:

Many people are interested in the kind of improvements that the tested VMs can bring to a Ruby on Rails deployment stack. Please do not assume that if VM A is three times faster than VM B, that Rails will serve three times the amount of requests per minute. It won't. That said, a faster VM is good news and can definitely affect Rails applications positively in production;


In an InfoQ interview Antonio explains the need for more real world benchmarks, and points to the Ruby Benchmark Suite project he set up for this purpose.

windows can be faster by Roger Pack Posted Dec 17, 2008 11:13 AM
Re: windows can be faster by Daniel Berger Posted Dec 18, 2008 5:21 PM
Re: windows can be faster by Roger Pack Posted Feb 26, 2009 5:10 PM
  1. Back to top

    windows can be faster

    Dec 17, 2008 11:13 AM by Roger Pack

    If you use the mingw version for windows, it's much faster.
    www.akitaonrails.com/2008/7/26/still-playing-wi...
    Also note that 1.9 can run most 1.8 code. See the NEWS file for changes.
    -=R

  2. Back to top

    Re: windows can be faster

    Dec 18, 2008 5:21 PM by Daniel Berger

    It's faster still if you compile with VC++ 9. And run on 2008 Server instead of an OS designed solely for desktop use.

  3. Back to top

    Re: windows can be faster

    Feb 26, 2009 5:10 PM by Roger Pack

    I'd be interested in testing your VC++ 9 sometime :)
    Also it is faster still if you tweak the GC -- google "ruby gc patch"
    -=r

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.