2

Possible Duplicate:
How to improve jRuby load time?

When developing a site using jruby on rails I find it quite annoying that every time I invoke jrake db:migrate or rails g migration I have to wait a few seconds for the java engine to start...

$ time rails -v
Rails 3.0.0

real    0m6.947s
user    0m10.590s
sys     0m0.230s

Is there a way around this? Maybe I could install regular rails too and use its toolset; that would probably work to some extent except that jrails and rails connect to the database differently. Is there no way to have a java VM running on standby somehow to avoid the expensive startup?

Addendum: maybe it isn't java's or jruby's fault? Maybe it's just rails'?

$ time echo 1+1 | jirb
1+1
2  

real    0m0.930s
user    0m1.090s
sys     0m0.040s

$ time echo 1+1 | rails c
Loading development environment (Rails 3.0.0)
1+1 
2

real    0m14.719s
user    0m22.080s
sys     0m0.600s

14 s is a long time to wait... :(

Community
  • 1
  • 1
einarmagnus
  • 3,507
  • 1
  • 21
  • 31
  • I don't think comparing jirb with rails shows that it is just rails. Classloading is always what takes the Java interpreter so long to start. In the case of jirb, there are very few classes to load, where rails has tons. – Tim Yates Sep 23 '10 at 12:48
  • A few seconds? Would it make you feel better to know that our last project took five minutes to redeploy ón the test server? – Thorbjørn Ravn Andersen Sep 23 '10 at 13:29
  • @Thorbjörn: :) @Jörg: yes, thanks for the pointer, there were some suggestions I'll try. Will try to improve my search skills too, sorry. – einarmagnus Sep 23 '10 at 14:23

0 Answers0