Speeds Up Your Rails3 Rake Assets:precompile

turbo-sprockets-rails3加入到Gemfile中

Gemfile
1
2
3
4
group :assets do
  ...
  gem 'turbo-sprockets-rails3'
end

然后

1
bundle install

下面是速度调试对比

*加之前

1
2
3
4
5
6
$ time RAILS_ENV=production bundle exec rake assets:precompile
/Users/xxx/.rvm/rubies/ruby-1.9.3-p125/bin/ruby /Users/john/.rvm/gems/ruby-1.9.3-p125@3.9/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets

real  1m45.970s
user  1m35.596s
sys   0m5.559s

*加入之后

1
2
3
4
5
$ time RAILS_ENV=production bundle exec rake assets:precompile
/Users/xxx/.rvm/rubies/ruby-1.9.3-p125/bin/ruby /Users/john/.rvm/gems/ruby-1.9.3-p125@3.9/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
real  0m56.796s
user  0m50.407s
sys   0m3.604s

参考:https://github.com/ndbroadbent/turbo-sprockets-rails3

原文地址:http://dlj.bz/3vgKkk

Comments