Rails 3 initializes extremely slow on Ruby 1.9.2

元气小坏坏 提交于 2019-12-03 05:39:14

问题


I'm using RVM for managing environment, installed Ruby 1.9.2.p136 (i think its latest release.) and Rails 3, created gemsets and run bundler. everything working good so far but;

Rails initalizes extremely slow when running commands, i.e. generate, destroy, rake etc. Takes about 30-45 seconds to complete command. This will never happens if use Ruby Enterprise Edition or Ruby 1.8.7

Why this happens. Any thoughts? Running on Ubuntu 10.10, RVM, Ruby 1.9.2, Rails 3

Thanks.


回答1:


There is a thread about this on Rails-Core - http://groups.google.com/group/rubyonrails-core/browse_thread/thread/88519ef5a53088a1/c01ba447c6dc0de7?lnk=raot

To quote Yehuda Katz

"There are things that the C require code does in 1.9 that slow things down. One such example is re-checking $LOAD_PATH to make sure it is all expanded on every require. This is something that should be addressed by ruby-core. I'll open a ticket on redmine if there isn't one already."

I am also experiencing this problem and a $LOAD_PATH issue seems like a potential cause. Lets hope it gets fixed soon.




回答2:


Try to strace (on unix), dtruss (on mac) your command (might need to "sudo" though). It'll show you where the process is spending its time. Notice where it pauses. This is definitely not normal.



来源:https://stackoverflow.com/questions/4789248/rails-3-initializes-extremely-slow-on-ruby-1-9-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!