I tried to use nailgun which is supposed to speedup jruby usage by sharing a single jvm over multiple jruby instances. It all seems to be a bit broken but this is what works for me:
In .rvmrc change --1.9
to --Xcompat.version=1.9
to avoid a stupid bug
Run jruby --ng-server
in one terminal
Now env JRUBY_OPTS="$JRUBY_OPTS --ng" bundle exec rake spec
should give you somewhat better startup time (factor 2 for me).
Caveat: This seems to be totally broken with interactive programs like irb (results are not printed). The reason is that readline doesn't work over the socket connection right now. As a workaround, run irb --noreadline
. To still get readline support, install rlwrap or a similar tool, i.e. run
env JRUBY_OPS="$JRUBY_OPTS --ng" rlwrap bundle exec irb --noreadline
To avoid having to set JRUBY_OPTS and calling rlwrap all the time, I use the following aliases
export BUXWRAP=''
alias bux='"$BUXWRAP" bundle exec'
alias ng='export BUXWRAP=rlwrap JRUBY_OPTS="$JRUBY_OPTS --ng"'
alias nong='export BUXWRAP='' JRUBY_OPTS=`echo "$JRUBY_OPTS" | sed -e s/--ng//g`'
If you run irb from rake, add a line like
IRB.conf[:USE_READLINE] = false if ENV['JRUBY_OPTS'] =~ /--ng/