There is no denying that Ruby on Rails is creating some noise amongst the web development circles – you have read the blogs, and maybe bought the t-shirt, but did you know that Ruby as a language has been getting some attention too?
Up until now you would have been using the original Matz Ruby Interpreter (MRI) built by the Ruby designer – Yukihiro Matz Matsumoto. This is the standard interpreter that is installed on Linux and OSX by default. However, there have been a few issues.
- Speed: By design, an interpreted language is going to be slower than a compiled one – the interpreter needs to parse and compile the source on every run.
- Integration: If you want to connect to, say an ActiveDirectory server or MSQL server, you need libraries written in Ruby. This can cause some headaches if you try to use Ruby on enterprise
So a few groups of very smart people have been working towards different versions of the Ruby interpreter to alleviate this issues.
JRuby is a port of the Ruby interpreter in Java. This is is probably the most mature, with a mostly complete library set, and can it run Rails (unofficially). As well as being able to access all of the standard Java libraries, JRuby can be compiled in to bytecode (using Just-in-Time or Ahead-of-time compilation), which eliminates the parsing and compiling stage that the MRI needs to perform. This makes JRuby faster than MRI in a lot of cases. This speed up is noticeable when running the JRuby version of mongrel.
Rubinius is a project attempting to build a virtual machine for the Ruby language. A Ruby Virtual machine works the same way that the Java Virtual Machine works – the code is compiled and optimised into a common bytecode, which is then executed by the VM. This has the speed advantage of eliminating the parsing and compilation stage, whilst still allowing portability between platforms. The Rubinius team has also built the most complete set of unit tests for Ruby, which many of the other projects use.
IronRuby is a port of Ruby that runs in the Microsoft .NET Dynamic Language Runtime (DLR) platform. Taking up where Ruby.NET left off (which was built using the Common Runtime Language), IronRuby aims to compile Ruby into the .NET intermediate language (basically the same thing as the Java or Rubinius bytecode). Just as JRuby allows Ruby to access Java class files, IronRuby will allow IronRuby to access .NET assemblies. In fact, bacause .NET is language agnostic, you could even use it to write ASP.NET or Silverlight and integrate with code written in C# or VB.NET. IronRuby is still in the early stages, mainly because the DLR API has yet to be finalised but regardless, is making progress.
As you can see, there is a lot going on at the lower levels of Ruby. If you are interested, you can download and run all of these systems – just don’t expect them to all work properly yet!