【问题标题】:Poor time performance of 'rake assets:precompile''rake assets:precompile' 的时间性能不佳
【发布时间】:2012-01-24 00:33:36
【问题描述】:

跑步:

bundle exec rake assets:precompile RAILS_ENV=production

总共大约 250kb 的 15 个 .js 文件大约需要 6 分钟。肯定不会花这么长时间吧?我看到“基于 Microsoft 控制台的脚本宿主”大部分时间都在正常工作。

人们会推荐/知道什么是可能的? 有没有办法用 Ruby-Racer 或其他 javascript V8 引擎实现替换它?或者找出我的代码中导致长时间的问题? 还是别的什么?

【问题讨论】:

    标签: javascript ruby-on-rails performance pre-compilation


    【解决方案1】:

    您正在运行哪个服务器?是 Ubuntu、Debian 还是 Mac? 确保你的 Gemfile 中有这个:

    group :production do
      gem "libv8"
      gem "therubyracer", :require => 'v8'
    end
    

    查看此页面了解更多信息: https://github.com/rails/rails/issues/2537

    您也可以尝试删除 app/assets/* 文件夹中未使用的文件。 大部分时间花在 JS 编译上。

    【讨论】:

    • 如何在我的 app/assets 文件夹中找到未使用的文件?例如,我怎么知道哪些是未使用的 jquery 组件,或 ckeditor 组件?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-11
    • 1970-01-01
    • 1970-01-01
    • 2011-12-08
    • 2013-04-20
    • 1970-01-01
    相关资源
    最近更新 更多