Rails 3 在 Ruby 1.9.2 上初始化非常慢 [英] Rails 3 initializes extremely slow on Ruby 1.9.2
问题描述
我使用 RVM 来管理环境,安装了 Ruby 1.9.2.p136(我认为是它的最新版本.)和 Rails 3,创建了 gemset 并运行了 bundler.到目前为止一切正常但是;
Rails 在运行命令时初始化非常慢,例如 generate、destroy、rake 等.完成命令大约需要 30-45 秒.如果使用 Ruby Enterprise Edition 或 Ruby 1.8.7 就不会发生这种情况
为什么会这样.有什么想法吗?在 Ubuntu 10.10、RVM、Ruby 1.9.2、Rails 3 上运行
谢谢.
Rails-Core 上有一个关于此的主题 - http://groups.google.com/group/rubyonrails-core/browse_thread/thread/88519ef5a53088a1/c060drat79> 引用耶胡达·卡茨的话 C 要求代码在 1.9 中做的一些事情会减慢速度.一个这样的例子是重新检查 $LOAD_PATH 以确保它全部展开在每一个要求.这是 ruby-core 应该解决的问题.如果还没有的话,我会在 redmine 上开一张票." 我也遇到了这个问题,$LOAD_PATH 问题似乎是一个潜在的原因.让我们希望它尽快得到修复. 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. 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. 这篇关于Rails 3 在 Ruby 1.9.2 上初始化非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!