Update heuristic for pre-prefetch commit loading #1878
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.
Description
This change is intended to improve the heuristic for loading commits when a prefetch has not completed, either because the clone was run with
--no-prefetchor becausegvfs.trustPackIndexesis set tofalse.Previously the heuristic for loading commits before prefetch has completed is:
This works for the most basic case where a user clones a repo, then checks out a branch other than the default. It also limits over-downloading when history or commands are run that load many commits but need few objects from them.
However, it doesn't work well when these are combined (eg a history command is run first, then a checkout), or when multiple commands are run in far-apart sections of the commit graph in less than a 5-minute period.
The new heuristic is:
N is currently set to 200, which is approximately the number of trees that are downloaded in the first 3 seconds of attempting to checkout a branch where many trees would be downloaded without batching.
Downloading the entire tree graph for a commit as a pack takes about 1 second, so this should limit the amount of time to download all trees for a commit to about 4 seconds, but also be unlikely to download the commit packs for history/blame operations that only need a few trees per commit.
Changes
InProcessMount.cs