Because loading gems take longer than you think
$ curl -fsSL https://gist.github.com/raw/5022636/benchmark.rb | ruby
............................................................[DONE]
Gem Time(sec) Pct %
--------------------------------------------------
jazz_hands 1.1986 12.6%
mongoid 1.0774 11.4%
fog 0.7371 7.8%
newrelic_rpm 0.6181 6.5%
ruby-prof 0.5841 6.2%
debugger 0.3582 3.8%
geocoder 0.3345 3.5%
delayed_job 0.3147 3.3%
bitly 0.2678 2.8%
turbo-sprockets-rails3 0.2658 2.8%
sass 0.2614 2.8%
--------------------------------------------------
Total 4.8583 100.0%Forked from this awesome gist by Pan Thomakos.
curl -fsSL https://gist.github.com/raw/5022636/benchmark.rb | rubyTo only require certains groups (like Rails does), do
# Rails development default groups
curl -fsSL https://gist.github.com/raw/5022636/benchmark.rb | BUNDLE_GROUPS=default,development,assets rubyRead this article
http://iain.nl/getting-the-most-out-of-bundler-groups
I reduced our gem load time from 12.1 seconds to 6.7 seconds - over 5 seconds!
Here's what I did:
-
Added :console group like the article above suggested
-
Commented out
ruby-prof,oink, anddebuggerwhen not in use -
Moved
newrelic_rpmandturbo-sprockets-rails3to :staging, :production groups -
Removed unused gems
time script/rails console # or server, etcis faster than
time bundle exec rails consoleTry it yourself