At 10:45 PM -0700 8/15/09, AlwaysCharging wrote:
Why would anyone use ruby over Jruby? I’m admittedly a noob about all
this stuff, but from what I’ve read jruby seems superior to ruby and
quite a bit faster. What would be the disadvantages of JRuby? I man
it’s possible to use it with rails now, and JRuby is what’s used by
default in netbeans (which is the ide I think I’ve settled on). So
why not JRuby? Would the tutorials be all that different?
I use both MRI and JRuby – often at the same time in the same
project when developing.
One advantage I didn’t see in the thread so for MRI is that the
interpreter starts fast. This is great when starting lots of small
tasks from the console.
Here’s a couple of pluses for JRuby that I haven’t seen mentioned:
-
It is very easy to make multiple, complete, and isolated Ruby
installation using JRuby. I know there are some tools to make this
easier in MRI – I even wrote a simple one – but this is trivial in
JRuby.
-
For some rendering operations in development mode JRuby can be 20x
faster.
This is a strange result – in general I’ve found JRuby to be about
twice as fast as MRI in production … but I’d never seen this result
before …
I’ve got a complex Rails application for authoring secondary science
investigations and one of the render tasks generates a composite xml
document that represents all of the objects in an investigation.
Right now the largest investigation is about 350k rendered into xml
and represents over 1100 objects. Roughly that corresponds to about
1100 partial calls.
I have not done ANY work on improving performance in the rendering
speed yet (lots of partials calling partials) and noticed that the
render speed when running in MRI in development mode has gotten very
long as authors have finally started making real investigations.
I put together a benchmark measuring the time to render 11
investigations in xml.
The JRuby results were quite impressive:
Development Production
=======================================
MRI: 849s 30s
JRuby: 35s 18s
The rendering is done with HAML.
I have no idea why rendering in dev mode in MRI is SO slow.
There’s obviously a problem somewhere in the interaction with Rails,
my code, MRI and development mode. But the fact that JRuby running in
development mode renders all 11 Investigations into xml only 15%
slower than MRI in production is great. It also means that when I am
testing or developing these features in the app I run my dev server
in JRuby.
While I plan to work on performance later in most cases in production
the Investigations will be frozen and the xml doc will be served from
a page cache – so performance improvements in rendering are not on
the critical path for the production app.
This is running on Mac OS X 10.5.8 and Rails 2.3.3
MRI and JRuby versions:
$ jruby -v
jruby 1.4.0dev (ruby 1.8.7p174) (2009-08-09 6586) (Java HotSpot™
Client VM 1.5.0_19) [i386-java]
$ ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
more details:
http://groups.google.com/group/cc-developers/browse_thread/thread/af4ca01be8eb41ab?hl=en