The Artima Developer Community
Sponsored Link

Ruby Community News Forum
Antonio Cangiano Benchmarks Seven Ruby Implementations

1 reply on 1 page. Most recent reply: Feb 19, 2007 3:22 PM by Joao Pedrosa

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Antonio Cangiano Benchmarks Seven Ruby Implementations Posted: Feb 19, 2007 2:14 PM
Reply to this message Reply
Summary
Performance is the main concern for developers contemplating Ruby applications for the enterprise. Antonio Cangiano recently compared the performance of seven Ruby implementations, including JRuby and the upcoming Ruby 2.0 virtual machine, Yarv.
Advertisement

Almost every comparison of Ruby, and especially Rails, with other enterprise frameworks and languages includes the obligatory cautionary note about performance. The gist of such warnings is that while Ruby allows quicker development cycles, Ruby applications that need to do a lot of computing generally perform poorly.

Such observations often fail to mention that there are several Ruby implementations developers can choose from, each with its own performance characteristics. Antonio Cangiano's recent article, Ruby Implementations Shootout: Ruby vs Yarv vs JRuby vs Gardens Point Ruby .NET vs Rubinius vs Cardinal, provides much needed performance details of seven Ruby implementations.

As with any benchmark, Cangiano warns his readers to take the performance figures with more than a small grain of salt. He used Windows Vista and Linux as the benchmark platforms, and employed 41 tests that are available in the public Ruby 1.9 source code repository.

The most interesting aspects of the results are that:

  • Only the Ruby 1.8.5 implementation on Linux and the early version of the Yarv VM were able to complete all the benchmark runs without errors;
  • Ruby 1.8.5 is actually quite fast compared with other implementations;
  • The upcoming Yarv VM promises a big performance boot for all Ruby applications. In a comparison chart, Cangiano shows that Yarv performed on average 3.47 times faster across all benchmarks than Ruby 1.8.5.

Cangiano summarizes his findings as follows:

Ruby on Windows was about 1.5 times slower than on Linux. Yarv (merged in the development version of Ruby) is clearly the fastest by a long shot. This is good news (there are hopes for a fast Ruby 2.0), and it is not an unexpected result.

Ruby.NET and JRuby had similar performances and were able to execute most of the tests. It is clear though that they will need to focus on improving their individual speeds in the coming future, in order to be ready for prime time.

Cardinal wasn’t able to complete most tests, and was extremely slow in some others. However on a few occasions, it also showed decent results (beating Ruby 1.8.5 in 3 tests). Rubinius was extremely slow too but correctly handled a larger amount of tests than Cardinal was able to (and it was significantly faster in executing so_sieve.rb).

What is your experience with Ruby performance in real applications?


Joao Pedrosa

Posts: 114
Nickname: dewd
Registered: Dec, 2005

Re: Antonio Cangiano Benchmarks Seven Ruby Implementations Posted: Feb 19, 2007 3:22 PM
Reply to this message Reply
It seems that Ruby can be relatively slow when you want extreme performance for operations like large parsing of XML, for example.

I've created a little chess program which can parse a file with chess games in it (PGN), and sometimes parsing+showing the games on screen can take a while, even though the code is probably inefficient in many ways as I haven't tried to optimize it (no interest).

Aside from this anecdote, Ruby works fast enough for me, even though I don't spare it of work. I just try to avoid the usual bottlenecks like database and I/O, and include in it reuse of parsed things by caching in memory, just to avoid the recurrent reprocessing of serving several requests, for example.

Ruby seems to use much less memory when compared to the famous Virtual Machines out there. :-) Another plus for Ruby is that it has many operations that seem kind of inexpensive, probably because Ruby has been optimized to work OK out-of-the-box, without forgetting the reliance on the usual speedy (Ruby) C extensions (many of which are core libraries, which are used all the time).

If one is to create a Web Application in Ruby, it's good to use a high performance front end server like Lighttpd or Nginx to serve the static files, while requesting from the Ruby/Rails server only the dynamic data. With this architecture, it should be possible to scale horizontally without much thought, as long as the shared data is kept in a central database, it should work almost transparently. :-)

If Ruby and Rails already work OK when taking these precautions, when Ruby 2.0 becomes stable, it might mean a good speed boost indeed, and the beginning of a new era, with Ruby losing the label of "slowest language". :-) Yay for Ruby is just as fast as the other ones! :-)

Flat View: This topic has 1 reply on 1 page
Topic: Microsoft Releases IronRuby Preview Previous Topic   Next Topic Topic: Ruby on Rails 1.2 Released

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use