In case you haven't heard, JRuby is an all-Java implementation of the Ruby programming language. And here at the Ruby-fest in San Jose Nick Sieger of the JRuby core team educates us on the current apple of his eye: JRuby: Ruby on the JVM
. He starts by asking, "What can Java do for Ruby?" Java, Sun's darling of programming languages, is hardly scoff-worthy. To start with it's got Applets! Faces! a five-line "Hello, World!" program! and it's enterprisey!
Woo hoo! But, can Sun -- which hired the JRuby project leads
last September -- convince the world that Ruby atop a JVM is the right answer?
Sieger dips into the C Ruby trunk
for a few benchmarks, including:
* Ruby still beats JRuby (interpreted) across the board, but JRuby is fast catching up.
* Ruby destroys JRuby (compiled) fairly consistently.
So where's JRuby today, and why should we care?
The 0.9.9 release of JRuby is slated for tomorrow. 0.9.9 improves on 0.9.8's performance by approximately 40 percent. Slightly less ambitious than the 0.9.9 release, a 1.0 is planned for early June.
Sieger's presentation gave way for a torrent of audience questions, most of which he handled rather gracefully.
He addressed the issue of compatibility with C Ruby, which presently lacks a compatibility suite. There are a slew of test suites up and running, including the C Ruby Sample and Language Test, Rubicon, Rubinius Specs, Rubyforge, ruby_test, Rails Tests, rSpec's own specs, BFTs, JRuby's own tests, etc.
Software unsupported by JRuby include Imagemagick, ParseTree, Mongrel, DBI and Ruport -- components that tend to have C code in them. Ouch.
Sieger confesses JRuby is most appropriate for long-running apps.
With regards to running multiple handlers, and acknowledging that Ruby on Rails isn't thread-safe, the integration contains a switch for creating multiple instances of JRuby inside the VM. This apparently could still use more testing, so those interested are invited to contribute.
Stability improvements in marshalling should help JRuby and C Ruby play more nicely in v 0.9.9.
Garbage collection still takes place entirely in Java. JRuby itself does no memory management, and debugger support has been an ongoing issue.
At present you still cannot get back to the Ruby source code from the Java stack trace -- this is a possible improvement for future versions.
Catch more at JRuby on Codehaus
and JRuby on Thresher