[dundee] Rails just a got a little faster

Rick Moynihan rick.moynihan at gmail.com
Mon Feb 18 16:23:48 GMT 2008


On 18/02/2008, Barry Carr <barry at benericht.co.uk> wrote:
> JRuby 1.1RC2 has just been released. And according to Charles Nutter's blog, here:
>
> http://headius.blogspot.com/2008/02/jruby-rc2-released-whats-next.html
>
> It regularly out performs standard Ruby 1.8.6 and Ruby 1.9. It appears to have better scalability too.
>

I've been using JRuby on a project at work and have been very
impressed with it.  For the most part it 'just works' and even in
JRuby 1.0.1 performance was good enough and  anecdotally comparable
with the 1.8.6 MRI.  Indeed the only performance issues I noticed was
in JVM startup and initialising Ruby scripts.

Every library and app I've thrown at JRuby (including Rails) has just
worked, though those that make use of native code often require a
JRuby specific gem, e.g. hpricot.

The only issue I ran into was concerned with multiple (Java) threads
accessing a single JRuby instance.  This caused me to implement a
rather crude locking mechanism outside of the interpreter, around code
evaluating a script, though it appears that this issue was fixed 3
days ago and back ported to 1.0.4 :-)

http://jira.codehaus.org/browse/JRUBY-251

Considering JRuby's barely been running for a year, they've made
incredible progress!  An excellent project, which aside from the
improvements they wish to make, is really only in need of better
documentation, particularly around the API's bridging Java and Ruby.

For example it took me a while to figure out how to define a java
array inside Ruby to pass into a java object/method, which is easy
when you know how, but hard to work out:

ser_array = java.io.Serializable[2].new
ser_array[0] = obj_a
ser_array[1] = obj_b
java_obj.method_taking_a_serializable_array(ser_array)

Also it's not quite as easy as the ruby idiom, which unfortunately
can't be used as Array's in java aren't objects:

obj.method [obj_a, obj_b]

I can't help but think more convenience methods/classes around these
edge cases could help bridge the type systems.  Still, it's great to
see the concept of using the JVM as an environment for alternative
languages is finally being so successfully proven!

R.



More information about the dundee mailing list