【问题标题】:Rails 3.2.1 development mode terribly slowRails 3.2.1 开发模式非常慢
【发布时间】:2012-02-10 13:28:53
【问题描述】:

为什么我的 Rails 开发环境如此缓慢?我在通话记录中看到 2-3 秒,控制器操作的实际时间约为 10 秒。大部分时间似乎都花在了资产管道上。

到目前为止,像 rails-dev-tweaks 这样的 Gem 并没有真正的帮助。

  • 我的设置:
  • OS X 完全更新
  • Ruby 1.9.3-p0 通过 rvm
  • Rails 3.2.1
  • 通过自制软件安装 MySQL
  • 服务器 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)

【问题讨论】:

  • 想知道您是否以某种方式将资产管道设置为以某种方式在每个请求上重新编译静态资产?想从您的 environment.rb/development.rb 文件中发布您的资产相关设置吗?
  • 如果是代码问题,用 Benchamark 包起来,你会缩小范围。
  • App 是从 devise/rspec/cucumber... 应用模板生成的 gist.github.com/1790241
  • 好的,我找到了它,它是应用程序模板附带的 Rails 脚注 gem。 github.com/RailsApps/rails3-devise-rspec-cucumber当心!
  • @user1202128 我同意 Platinum Azure

标签: ruby-on-rails asset-pipeline ruby-on-rails-3.2


【解决方案1】:

好的,我知道是什么让它变慢了。这是应用程序模板随附的 Rails 脚注 gem,来自:http://github.com/RailsApps/rails3-devise-rspec-cucumber

我还在 github 上创建了一个问题: https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/22

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-22
    • 1970-01-01
    • 2013-02-24
    • 2017-05-27
    • 1970-01-01
    • 2019-04-13
    • 2020-01-02
    • 1970-01-01
    相关资源
    最近更新 更多