Speed up bundler/setup by using the raw Gemfile.lock information without extra processing whenever possible#5695
Merged
deivid-rodriguez merged 2 commits intomasterfrom Jul 9, 2022
Merged
Conversation
This case is a bit special, because although the Gemfile has been changed with respect to the lockfile, it doesn't need a re-resolve. I think it's nice to give a different message about this case.
4 tasks
Doing this has a cost for every `bundler/setup` invocation, however, it's not necessary in most cases. It's only needed if: * Resolution includes a pretty convoluted combination of platform specific dependencies. * Lockfile was generated with Bundler < 1.16.2, and was re-bundled with a newer version. So, we can detect the above situation and only do the cleanup in that case. On a reasonably big example Gemfile, this provides a `bundler/setup` speed up of about 5%.
d550c2a to
53b71ff
Compare
deivid-rodriguez
added a commit
that referenced
this pull request
Jul 13, 2022
Speed up `bundler/setup` by using the raw `Gemfile.lock` information without extra processing whenever possible (cherry picked from commit b7a90d9)
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What was the end-user or developer problem that led to this PR?
We should make
bundler/setupas fast as possible, since it's the cost that all scripts using Bundler to select versions of dependencies pay.What is your fix for the problem, implemented in this PR?
I noticed that even in the case where the
Gemfilehas no changes over theGemfile.lockfile, we're still doing some processing over the rawGemfile.lockrecorded resolution that did not seem necessary.Further investigation revealed that this is only done for two edge cases:
So my fix is to explicitly detect the above two situations and only do the extra processing there. Otherwise, use the raw lockfile.
This speeds bundling the Gemfile in https://github.com/technicalpickles/big-gemfile by about 5%, but should speed up all invocations of
bundler/setupthat don't need a re-resolve, the more dependencies, the more speed up.Make sure the following tasks are checked