Great Expectations for JRuby 1.0
Since the release of JRuby 0.9.8 about a month ago, information about JRuby progress has been a little hard to find. But the latest news out of the JRuby camp leaves us no doubt that it is because the team is working harder than ever in order to deliver JRuby 1.0 before JavaOne.
In his latest post, Charles Nutter gives us some very exciting tastes of improvements the first production release will bring. The performance boost is significant:
...the current trunk code is almost another 2X the performance of 0.9.8 (...). 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. There are actually a number of benchmarks running faster than MRI (the C version of Ruby) even when interpreted.
Another great piece of news is that Rails' ActiveRecord is now fully supported on JRuby. The last remaining failing tests have been fixed and all units tests are green. Now a Rails application using MySQL can run safely on JRuby.
InfoQ caught up with JRuby team member Ola Bini for more details on the latest ActiveRecord milestones:
Since when the JRuby team is working on the ActiveRecord support?
Actually, we aren't, as such. We haven't done anything on ActiveRecord itself, except possibly finding bugs in the tests. What we have been doing, since June last year, is working on the project ActiveRecord-JDBC (AR-JDBC from here on).
This project is an ActiveRecord adapter, only usable within JRuby, that allows ActiveRecord to work with JDBC (the standard Java database connection framework). It's absolutely necessary to have this, since JRuby can't use the database drivers that regular Rails uses. So we have had AR-JDBC working fairly well for quite some time. When we released 0.9.8, we decided to claim that we supported Rails, but we still had some failures in the Rails unit tests; and most of these were actually from ActiveRecord (about 50-60 errors and failures, out of about 1100 tests). So last week I decided to get these problems fixed for MySQL, first and foremost. This decision have resulted in several fixes to AR-JDBC and JRuby, and as the original announcement mentioned, we are happy to say that MySQL is fully supported now.
What were the toughest features to implement?
There are two things I would qualify as the toughest: first, the ActiveRecord tests. The tests are very good in many places, but there are also tests that depend on hash ordering and other more strange things. This makes it hard to see if it's actually a real failure, or just a strangely implemented test. Second, ActiveRecord does lots of processing on the data from the database, quoting and other things. These are hard to get right, especially for date and time information. But the tests are very helpful in fixing these issues.
Charles Nutter points out "a few caveats" remaining, could you give us more details about that?
Those caveats are first and foremost that there are a few tests that need to be modified to actually run correctly, as I mentioned above. Aside from that, all is dandy.
What are your next developments on JRuby?
Right now we're working hard on performance and correctness. We want to release 1.0 sometime in May, and at that point we're aiming for blazing speed and blinding correctness. =) Well, what we are doing is fixing all bugs we can find, trying to decide how the Java Integration features should finally look like, and also working the a Java bytecode compiler. So, in May, JRuby should be a force to reckon with.
A side question: you recently accepted an offer from ThoughtWorks. Could you give us some hints about your projects concerning JRuby with ThoughtWorks?
Well, not really. I won't actually start until June 4th. Until then I'm helping out informally with some projects, but most of it is still under cover. What I can say, is that when I start at ThoughtWorks I will be able to spend time on doing great things for both JRuby and Ruby.
Ben Linders May 28, 2015