In a recent blog post, JRuby project lead Charles Nutter gives an update on JRuby performance and compatibility.
The JRuby project has picked up a lot of steam since Charles Nutter and Thomas Enabo joined Sun last year to work full-time on turning the JVM into one of the best-performing Ruby runtimes. Anticipating an upcoming JRuby 1.0 release, Nutter recently summarized the current state of JRuby performance and compatibility in ActiveRecord 100%, Performance Doubling, Java Support Improving.
Since Rails is arguably the most popular Ruby framework, the JRuby project has been aiming to provide full compatibility for Rails applications. Nutter notes that ActiveRecord, Rails' object-relational framework, posed the biggest challenges, and that recent JRuby builds finally support ActiveRecord:
The module with the most failures has always been ActiveRecord. It's the most complicated and the weakest point in the JRuby on Rails story... Until now:
1031 tests, 3839 assertions, 0 failures, 0 errors
That's zero failures and zero errors when running against MySQL, but it's certainly a de-facto standard in the Rails world. The next step is to get as many other databases to 0/0 as possible. And those are much smaller steps than this first one... It also means that overall Rails support is well into the 99% range and still climbing.
Nutter also reports on performance improvements that in current JRuby builds exceed the native Ruby interpreter's performance on some benchmarks:
As a result of all our efforts, the current trunk code is almost another 2X the performance of 0.9.8, released less than a month ago....
There are actually a number of benchmarks running faster than MRI (the C version of Ruby) even when interpreted, showing that we're finally making good on our promise to have interpreted JRuby run as fast as MRI. So it truly does seem that the compiler will be "bonus" performance once we work out the remaining bottlenecks in the system..
Where calling into Java code was previously as bad as twenty times slower than calling Ruby code, it's now a modest two times slower. We expect to improve that further, getting as close to Ruby invocation speed as possible.
Finally, Nutter also comments that JRuby is now getting close to supporting the complete Ruby syntax:
The compiler also supports almost 2X the number of syntactic constructs it did in 0.9.8, and it's getting faster and more stable every day.
With the JRuby 1.0 release in the near future, would you consider running your existing Ruby and Rails applications on JRuby?
It's great that JRuby is improving so much, to the point of becoming a good alternative to the native implementation of Ruby.
After this little experience, I can ascertain that I would follow Ruby anywhere it went, be it in the Java or in the .NET -- even if their implementations weren't perfect.
I think many Ruby addicts would do the same when given a chance. :-)
That said, adopting JRuby as an exclusive platform of Ruby is not on my list for now. But JRuby working great is all the barrier removal guys like me could need for adopting it for real. I already considered Ruby my own "COBOL". Imagine JRuby, then? :-) Maybe JRuby will be the ultimate "COBOL" for me. I say that in a good way, though. :-)