Make bundler crazy fast
Paralellize gem installs
You can paralellize the installation of gems with bundler's jobs feature.
To use, simply run:
bundle install --jobs 3
This only works for bundler 1.4 or above
Or to enable globally for all future bundling:
bundle config --global jobs 3
Obviously jobs is the number you want to parallelize. Pick the number one less than the number of cores you have. If you don't, you may get deadlock errors.
Credit to @xianpants for the tip!
Disable documentation
Create a file at ~/.gemrc
with:
gem: --no-rdoc --no-ri
Unless, of course, you use local documentation.
Written by dickeyxxx
Related protips
8 Responses
choose the number of cores that you have on your machine. That will (in most cases) be optimal.
This will only work in the current --pre versions (1.4)
$ gem install bundler
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
1 gem installed
$ bundle install --jobs 4
Unknown switches '--jobs'
Noted!
As of Nov/3/2013, update to 1.4 (to use the parallelize feature) using:
gem install bundler --pre
Great idea with the global ~/.gemrc
. I sometimes remember to add that flag when installing but very rarely.
However, the --no-doc
and --no-ri
flags are deprecated in Ruby 2.0. So, the ~/.gemrc
might be slightly improved as:
gem: --no-document
I disabled Rubygem documentation in thoughtbot's dotfiles based on this tip, edited for Ruby 2.0.
I'm not someone who knows how many cores my machine has without looking it up. So, I think a slight improvement to the first line might be:
number_of_cores=`sysctl -n hw.ncpu`
bundle config --global jobs `expr $number_of_cores - 1`
That should automatically pick one number less than the number of cores on the machine.
I configured Bundler for parallel gem installs in thoughtbot's laptop script based on this tip, edited to dynamically use one number less than the number of cores on the machine.
Neat. Works pretty good.
i wonder why bundler doesn't do this by default