Channels ▼

Nick Plante

Dr. Dobb's Bloggers

Rubinius is Ruby in Ruby

May 30, 2010

After nearly 4 years of development, the Rubinius Project finally hit a proper 1.0 release earlier this month. Rubinius is an alternative Ruby implementation that is now fully compatible with Ruby 1.8.7 (MRI). While not the only alternative implementation, it's distinguished by the fact that the bytecode compiler is written in pure Ruby (the virtual machine itself is written in C++). Most of the core library is written in Ruby as well, which is pretty neat, and clearly inspired by the self-hosting nature of Lisp compilers. It also presents a perfect opportunity for Rubyists to dig in and learn about how their runtime platform actually works.

As of 1.0, you can now run both Rails 2.3.x and 3.x on Rubinius as well as Sinatra and a host of other Ruby web frameworks and toolkits (including any Gem that is written in pure Ruby without native bindings). Like it's cousin JRuby, it features a JIT compiler and also includes a generational garbage collector.

In terms of overall performance, Rubinius is making constant improvements. It runs Ruby code very fast, but since much of the core library is written in Ruby rather than C (as it is in MRI), certain benchmarks may run markedly slower. The team continues to improve the JIT, which will result in performance increases as it evolves. They're also actively engaged with the community and contributions are always encouraged.

Over 200 developers have participated in the development of the project, led by Evan Phoenix of Engine Yard (interview at InfoQ). Along the way, Rubinius has not only morphed itself into a capable Ruby runtime but has also contributed to other aspects of the Ruby ecosystem, such as introducing the RubySpec executable specification for testing compatibility of different Ruby implementations -- which has since been embraced by MRI, YARV, JRuby, IronRuby, and MagLev.

Want to test your own application out on Rubinius? The easiest way to is by using the Ruby Version Manager (RVM), a tool that makes it easy to install and manage a number of different Ruby implementations and versions, as well as Gem sets, on a single machine. Nomadicoder has written a simple set of instructions for getting Rubinius up and running quickly with RVM.

Of course, if you want to dive right into the source, it's available on GitHub. And since the majority of Rubinius is written in Ruby itself, it shouldn't be a stretch for the average Ruby developer to grok the code, which of course is the whole point of the affair. If you want to understand how your favorite language is actually implemented, and how dynamic languages can be fast, this is a great place to learn more, especially now that the project itself is a very capable feature-complete runtime.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.