carlhuda/bundler — Issue #1511: Bundler::Resolver.resolve time increases a lot as gems from git sources are added. 
Author: mathieuravaux
Created: 2011-11-01 05:40:32+00:00
State: open

During the sort, before resolving, the number of sources that contain a dependency is calculated, for each dependency.

For projects with a lot of gems specified as a git dependency, this is very slow.
This also seems unnecessary, since these 'git sources' will contain only one gem version, which is resolved de facto. Maybe they could be activated first, and then their 'git sources' ignored when calculating `#gems_size` ?

Here is a profile that shows 60.76% of an app boot time spent in `Bundler::Resolver#gems_size`, which asks each one of the git source if they contain each one of the known dependencies: http://f.cl.ly/items/0l0m0e0v312l28371E3j/boot_time_profile.html

The Gemfile contains 122 gems, 14 of them being specified from a particular git repository.

$ time BUNDLE_FROZEN=true ./bundle_bin/thin start
7,01s user 1,60s system 87% cpu 9,895 total
$ time ./bundle_bin/thin start
13,04s user 1,55s system 91% cpu 15,872 total

Since the resolve is by default done each time our projects boot, this considerably drags down the development.