cucumber/aruba — Issue #93: Tweak ENV vars for optimal JRuby performance
Author: myronmarston
Created: 2011-12-02 00:56:53+00:00
State: open

As most people know, JRuby suffers from slow startup times even though it performs very well over the lifetime of a long-lived process. Unfortunately, when you use aruba to test a command line tool on multiple ruby interpreters, including JRuby, you wind up with really, really slow performance on JRuby since the startup times are so bad and aruba is constantly shelling out to create new jruby processes.

There are a few ENV vars that most people aren't aware of that make a big difference:

* `JRUBY_OPTS=-X-C` disables the JIT, which is good for short lived scripts
* `JAVA_OPTS=-d32` forces it to use the client JVM which has better startup times than the server JVM

I got both of these settings from [this blog post](http://blog.headius.com/2010/03/jruby-startup-time-tips.html) for those who are interested.

I just [set these variables for rspec-core](https://github.com/rspec/rspec-core/commit/1592c942e0d0bd30127e3b8cf89194fe6fd118d6) and it cut **10 minutes** off of the build time. It allows us to build rspec-core on travis using JRuby.

We can change this for all the other rspec repos as well...but it got me thinking: why not put these settings directly into aruba itself? Not many people know about them, and given the short-lived nature of the processes aruba starts, I can't imagine a time when you wouldn't want them.

Thoughts?