简体   繁体   English

Rails 3在Ruby 1.9.2上初始化速度极慢

[英]Rails 3 initializes extremely slow on Ruby 1.9.2

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. 我正在使用RVM来管理环境,安装了Ruby 1.9.2.p136(我认为它的最新版本。)和Rails 3,创建了gemsets并运行了bundler。 everything working good so far but; 到目前为止一切运作良好但是;

Rails initalizes extremely slow when running commands, ie generate, destroy, rake etc. Takes about 30-45 seconds to complete command. 当运行命令时,Rails初始化非常慢,即生成,销毁,耙等。完成命令大约需要30-45秒。 This will never happens if use Ruby Enterprise Edition or Ruby 1.8.7 如果使用Ruby Enterprise Edition或Ruby 1.8.7,这将永远不会发生

Why this happens. 为什么会这样。 Any thoughts? 有什么想法吗? Running on Ubuntu 10.10, RVM, Ruby 1.9.2, Rails 3 在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 在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." “有些事情需要C代码在1.9中做的事情会减慢速度。一个这样的例子是重新检查$ LOAD_PATH以确保它在所有需求上都得到了扩展。这是ruby-core应该解决的问题。我如果没有红色的话,我会打开红色的票。“

I am also experiencing this problem and a $LOAD_PATH issue seems like a potential cause. 我也遇到了这个问题,$ LOAD_PATH问题似乎是一个潜在的原因。 Lets hope it gets fixed soon. 让我们希望很快得到修复。

Try to strace (on unix), dtruss (on mac) your command (might need to "sudo" though). 尝试strace(在unix上),dtruss(在mac上)你的命令(虽然可能需要“sudo”)。 It'll show you where the process is spending its time. 它会告诉你进程花费时间的地方。 Notice where it pauses. 注意它暂停的地方。 This is definitely not normal. 这绝对不正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM