简体   繁体   English

“rake assets:precompile”的糟糕时间表现

[英]Poor time performance of 'rake assets:precompile'

Running: 运行:

bundle exec rake assets:precompile RAILS_ENV=production

Takes about 6 minutes for 15 .js files of about 250kb total. 大约250kb的15个.js文件需要大约6分钟。 It should not take this long surely? 它不应该花这么长时间吗? I see the 'Microsoft Console Based Script Host' working flat out for most of this time. 我看到“Microsoft基于控制台的脚本主机”在大部分时间里都处于平稳状态。

What would people recommend / know is possible? 人们推荐/知道什么是可能的? Is there a way to replace this with Ruby-Racer or another javascript V8 engine implementation? 有没有办法用Ruby-Racer或其他javascript V8引擎实现替换它? OR to find out the problem in my code that's causing the long time? 或者找出我的代码中导致时间长的问题? Or something else? 或者是其他东西?

Which server are you running? 你在运行哪个服务器? Is it Ubuntu, Debian, Mac? 是Ubuntu,Debian,Mac吗? Make sure you have this in your Gemfile: 确保你的Gemfile中有这个:

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

See this page for more info: https://github.com/rails/rails/issues/2537 有关详细信息,请参阅此页面: https//github.com/rails/rails/issues/2537

You can also try to remove unused files in your app/assets/* folders. 您还可以尝试删除app/assets/*文件夹中未使用的文件。 Time is most spent on JS compilation. 时间最多花在JS编译上。

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

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