Poor time performance of 'rake assets:precompile'

允我心安 提交于 2019-12-30 19:04:24

问题


Running:

bundle exec rake assets:precompile RAILS_ENV=production

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.

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?


回答1:


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

See this page for more info: https://github.com/rails/rails/issues/2537

You can also try to remove unused files in your app/assets/* folders. Time is most spent on JS compilation.



来源:https://stackoverflow.com/questions/8568786/poor-time-performance-of-rake-assetsprecompile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!