开发者

Slow loading rails environment

Is it OK that loading my rails environment takes 25 seconds?

alhafoudh@xxx:~/Projects/xxx$ time ruby -r./config/environment.rb -e ""
real    0m25.320s
user    0m22.093s
sys     0m1.988s

alhafoudh@xxx:~/Projects/xxx$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]

alhafoudh@xxx:~/Projec开发者_运维问答ts/xxx$ gem list | grep rails
using rails 3.0.3

I am using also rvm


I solved it with downgrating my ruby stack to ree-1.8.7 :(


Bundler 1.1 helps speed things up, somewhat (20-25% gains).

Otherwise, remove unnecessary gems, if any - and harp on gem authors to lazy-load their library to speed things up.


Update: switching recommendation per comment suggestion

No need to downgrade. One workaround for this is to preload the rails environment with rails-sh. That way only the first rails/rake command is slow and the rest are pretty fast. Wrote a fuller answer to it in this question. I use it currently with ruby 1.9.3p194 with rails 3.2.6.


Do you use sqlite or other client-server database engine?

Please run rails console and check whether calling reload! method is also slow...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜