I had always wondered why when I installed jruby using rvm it always built something called Nailgun but I never bothered to search about it.
That was a mistake.
Nailgun is an amazing idea that greatly speeds up the start up time of the JVM and subsequently: jruby.
$ time jruby -e '' real 0m1.336s user 0m2.608s sys 0m0.205s
$ time jruby --ng -e '' real 0m0.265s user 0m0.001s sys 0m0.003s
As you can see, nailgun reduced the start up time for jruby by 500%. Now you may be asking "How do I get started using nailgun?". Well, if you are using rvm then all you need to do is enable the
after_use_jruby hook which will start up a nailgun server for you.
chmod +x "$rvm_hooks_path/after_use" "$rvm_hooks_path/after_use_jruby"
And that's all you need to do.
rvm jruby or
rvm use jruby will now start up a nailgun server if there isn't one running and it set the
--ng switch for all jruby runs.
If you aren't using rvm, you will have to compile nailgun and start up a nailgun server with
jruby --ng-server. Now whenever you run jruby you just add the
--ng switch and it will use the nailgun server. You may want to
export JRUBY_OPTS="--ng" to set the switch for all jruby runs.