This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
bundle install: don't re-download specs for installed gems #2680
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This proposal significantly improves
bundle install
performance when most (but not all) gems have already been installed. It eliminates a couple network roundtrips for the gems that are already installed. These roundtrips are to fetch a fresh copy of the spec for each gem.With this patch, running
bundle install
on my gem set (~200 gems) on my home cable+wifi reduced the run time by 60%, from ~80s to ~30s.The logic in question appears to originate from 500d94d, four years ago. The current comments don't mention any details about what might be "broken and wrong", and I don't know much about the historical context. One clue may be in a comment for the underlying
__swap__
method, which mentions Rubyforge.When I tried removing the line entirely, many specs broke. Could this be a test harness / teardown issue? Or is it related to why the logic exists?
In any case, moving the line into
Bundler::Source::Rubygems
(the only source it affects) allows the specs to pass while also reducing its frequency so it only runs for gems that need to be installed. This seems like the simplest change with the biggest benefit.