“rake assets:precompile”的糟糕时间表现 [英] Poor time performance of 'rake assets:precompile'
问题描述
正在运行:
bundle exec rake assets:precompile RAILS_ENV=production
大约250kb的15个.js文件需要大约6分钟。它不应该花这么长时间吗?我看到Microsoft基于控制台的脚本主机在大部分时间内都处于平稳状态。
Takes about 6 minutes for 15 .js files of about 250kb total. It should not take this long surely? I see the 'Microsoft Console Based Script Host' working flat out for most of this time.
人们推荐/知道什么是可能的?
有没有办法用Ruby-Racer或其他javascript V8引擎实现替换它?或者找出我的代码中导致时间长的问题?
或其他什么?
What would people recommend / know is possible? Is there a way to replace this with Ruby-Racer or another javascript V8 engine implementation? OR to find out the problem in my code that's causing the long time? Or something else?
推荐答案
你在运行哪个服务器?是Ubuntu,Debian,Mac吗?
确保你的Gemfile中有这个:
Which server are you running? Is it Ubuntu, Debian, Mac? Make sure you have this in your Gemfile:
group :production do
gem "libv8"
gem "therubyracer", :require => 'v8'
end
有关详细信息,请参阅此页:
https://github.com/rails/rails/issues/2537
See this page for more info: https://github.com/rails/rails/issues/2537
您还可以尝试删除 app / assets / *
文件夹中未使用的文件。
花在JS编译上的时间最多。
You can also try to remove unused files in your app/assets/*
folders.
Time is most spent on JS compilation.
这篇关于“rake assets:precompile”的糟糕时间表现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!