Significantly improve fetch speed of bottles #15579
Merged
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.
Now it's time to look at fetching.
On my machine, using
hello
as a test, this PR:brew fetch
speeds by ~4 seeconds if the bottle and manifest were not previously cached.brew fetch
speeds by ~2 seconds (to now be effectively 0 time beyond brew startup, formula loading etc) if the bottle and manifest have been previously cached.The improvements in this PR are largely specific to the GitHub Packages download strategy, where I have added some shortcutting due to assumptions we can make based on how GitHub Packages downloads work. Specifically, I've removed all header checks which means that:
No redirection checks does have some security effects worth noting (remember these only apply to bottle and manifest downloads - source downloads are unchanged):
HOMEBREW_NO_INSECURE_REDIRECT
no longer has any effect on bottlesThis PR also has the following changes that impact all downloads (bottle and source):
Combining this and the install chages, give
brew install hello
a try with and without cached downloads.