precompiling assets under jruby June 16, 2012
The solution to fast asset compilation under jruby is to use node as your js engine.
Since everyone in this shop uses *nix-like operating systems, slipping this into production.rb worked just fine:
if defined?(ExecJS) && system('which node') puts "Using Node ExecJS runtime" ExecJS.runtime = ExecJS::Runtimes::Node end
This will do a rudimentary check to ensure that node is available and if it is, will setup ExecJS to use it as the runtime. It will only attempt any of this if ExecJS is loaded.
This made our asset precompilation time go from about 79 minutes to 5 minutes. Under c-ruby/v8 it takes about 3 minutes. So, still not awesome but 'good enough'.