Has anyone gotten spork to work with rails 3?
I haven’t been able to get it working with jruby v1.5.3 and rails 3.0.1.
Without spork, running a single rspec script takes 30 seconds on my
relatively new Macbook Pro.
I tried spork’s main branch (timcharper) and a number of forks of spork
(heh) including rdp/Roger’s and Nick S.'s.
Details at http://github.com/timcharper/spork/issues#issue/60
A few more tips and explanations.
#1 Make sure you’re running the “client” VM. jruby -v will show which
~/projects/jruby ➔ jruby -v
jruby 1.6.0.dev (ruby 1.8.7 patchlevel 249) (2010-11-22 43f380a) (Java
HotSpot™ 64-Bit Server VM 1.6.0_22) [darwin-x86_64-java]
The “server” VM is much slower starting up, so JRuby’s startup tries
to force “client” by passing -client to the JVM. If you are on a 64-
bit JVM, there is only “server”, and your best bet is to install a 32-
bit JVM for local testing/dev purposes. If you’re on OS X, you
probably have the 32/64-bit combined JVM, but it defaults to 64-bit
server…set JAVA_OPTS=-d32 and it should be markedly faster.
#2 Disable RubyGems plugins by commenting out everything after
“Gem.clear_paths” in lib/ruby/site_ruby/1.8/rubygems.rb
RubyGems scans all installed gems every time you require it, looking
for plugins, even if you aren’t using plugins or RubyGems command-line
at all. If you don’t need any plugins, you can comment this code out
and things will start up much faster.
There’s also a problem with some Rails commands re-launching Rails
+Ruby (JRuby) a second time after booting, which ultimately means you
pay that boot cost twice. I filed a bug against Rails that has not yet
This may or may not affect test runs.