Rails 3.2.1 开发模式极其缓慢
为什么我的 Rails 开发环境如此缓慢?我在日志中看到一次调用需要 2-3 秒,而控制器操作的实际时间约为 10 秒。大部分时间似乎都花在了资产管道上。
像 Rails-dev-tweaks 这样的 Gem 到目前为止并没有真正的帮助。
- 我的设置:
- OS X
- 通过 rvm
- Rails 3.2.1
- 日志输出安装 MySQL
- 完全更新了 Ruby 1.9.3-p0 通过 homebrew Server POW 或 webrick
:
Started GET "/" for 127.0.0.1 at 2012-02-10 13:14:34 +0000
Processing by HomeController#index as HTML
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
User Load (0.7ms) SELECT `users`.* FROM `users`
Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 1 LIMIT 1
Rendered home/index.html.erb within layouts/application (40.2ms)
Rendered shared/_navigation.html.erb (0.7ms)
Completed 200 OK in 2084ms (Views: 44.6ms | ActiveRecord: 9.6ms)
Why is my Rails development environment so terribly slow? I am seeing 2-3 seconds in the log for a call, the actually time is about 10 seconds for a controller action. A good chunk of time seems to be spent on the asset pipeline.
Gems like rails-dev-tweaks do not really help so far.
- My Setup:
- OS X fully updated
- Ruby 1.9.3-p0 via rvm
- Rails 3.2.1
- MySQL installed via homebrew
- Server POW or webrick
log output:
Started GET "/" for 127.0.0.1 at 2012-02-10 13:14:34 +0000
Processing by HomeController#index as HTML
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
User Load (0.7ms) SELECT `users`.* FROM `users`
Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 1 LIMIT 1
Rendered home/index.html.erb within layouts/application (40.2ms)
Rendered shared/_navigation.html.erb (0.7ms)
Completed 200 OK in 2084ms (Views: 44.6ms | ActiveRecord: 9.6ms)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我知道是什么让它变慢了。这是来自应用程序模板的 Rails Footnotes gem: http://github.com /RailsApps/rails3-devise-rspec-cucumber
我还在 github 上创建了一个问题:
https://github.com/RailsApps/rails3-devise-rspec-cucumber /问题/22
OK, I figured out what made it slow. It was the Rails Footnotes gem that came with the app template from: http://github.com/RailsApps/rails3-devise-rspec-cucumber
I have also created an issue on github:
https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/22