Bundle supports parallel processing with --jobs
:
The --jobs option (-j for short) installs gems in parallel. For example, bundle install -j4 will use 4 workers. We've seen speedups of 40-60% on fresh bundle installs. To always install in parallel, run bundle config --global jobs 4 or set BUNDLE_JOBS.
4 is the example used here, but why not 2 or 8? Is there an optimum number or a way to calculate the optimum number of parallel processes? If the time is bound by network activity, I'd have thought it should be high, e.g. 64, or if bound by computation, then maybe the number of cores on the machine.
It all depends on how many cores your CPU has and the available memory. Assuming you have decent memory amount, you can use the number of cores as your -j parameter. If you are on linux, you can run this command to list your cores:
cat /proc/cpuinfo | grep processor