Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sparse index expansions from untracked file stashes #433

Merged
merged 3 commits into from Sep 24, 2021
Merged

Remove sparse index expansions from untracked file stashes #433

merged 3 commits into from Sep 24, 2021

Conversation

vdye
Copy link
Collaborator

@vdye vdye commented Sep 24, 2021

Changes

  • Reduce the conditions in which the index is expanded in checkout-index --sparse (it's only needed if a sparse directory is present to expand)
  • Update unpack_trees to set the result to "sparse" if it does not meet any conditions that require a full index
  • Move the stash -u & stash pop test out of its own custom test case and into sparse index is not expanded
    • It no longer expands any index, temporary or not, if all files in the stash are in the checkout cone

Performance

Overall, there weren't substantial differences in the performance of stash. That's more-or-less expected - the index expansions removed only apply to the "temporary" untracked file indexes, which are substantially smaller than the regular repository index.

Test                                                              ms/vfs-2.33.0     remove-index-expansions
-----------------------------------------------------------------------------------------------------------
2000.2: git stash && git stash pop (full-v3)                      4.10(2.77+1.17)   3.92(2.69+1.13) -4.4%  
2000.3: git stash && git stash pop (full-v4)                      3.85(2.61+1.11)   4.19(2.83+1.18) +8.8%  
2000.4: git stash && git stash pop (sparse-v3)                    1.39(0.34+1.87)   1.47(0.35+1.85) +5.8%  
2000.5: git stash && git stash pop (sparse-v4)                    1.44(0.33+1.83)   1.48(0.35+1.78) +2.8%  
2000.6: echo >>new && git stash -u && git stash pop (full-v3)     4.68(3.10+1.54)   4.88(3.19+1.60) +4.3%  
2000.7: echo >>new && git stash -u && git stash pop (full-v4)     4.32(2.95+1.36)   4.24(2.88+1.30) -1.9%  
2000.8: echo >>new && git stash -u && git stash pop (sparse-v3)   1.60(0.39+1.84)   1.77(0.44+2.03) +10.6% 
2000.9: echo >>new && git stash -u && git stash pop (sparse-v4)   1.74(0.43+1.98)   1.76(0.44+2.23) +1.1%

@vdye vdye self-assigned this Sep 24, 2021
Copy link
Collaborator

@ldennington ldennington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great comments and commit description - made it super easy to follow your work!

Copy link
Collaborator

@derrickstolee derrickstolee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the subtle point here: this isn't really a performance fix, but allows us to use ensure_not_expanded on these two commands (which is a valuable way to protect the performance in the future).

builtin/checkout-index.c Show resolved Hide resolved
unpack-trees.c Outdated Show resolved Hide resolved
After `unpack-trees` processing, the index would only be considered "sparse" if
it contains any sparse directories. That condition missed the case where the
index contains only files inside the sparse checkout definition. By explicitly
checking for that condition and setting `sparse_index` accordingly, later
processing to ensure the index "remains" full can be avoided.

Signed-off-by: Victoria Dye <vdye@github.com>
When `--sparse` is specified for `checkout-index` but no sparse directory
entries exist outside the sparse checkout definition, the index does not need
to be expanded. For this case, moving the index expansion into an explicit
check for a sparse directory entry prevents unnecessary expansion.

Signed-off-by: Victoria Dye <vdye@github.com>
Move the test for `git stash -u` into the `sparse-index is not expanded` test
because it no longer expands the index (temporary or otherwise) when all
stashed files are in the sparse checkout definition.

Signed-off-by: Victoria Dye <vdye@github.com>
@vdye vdye merged commit b05892f into microsoft:vfs-2.33.0 Sep 24, 2021
@vdye vdye deleted the remove-index-expansions branch September 24, 2021 21:04
dscho pushed a commit that referenced this pull request Oct 30, 2021
Remove sparse index expansions from untracked file stashes
derrickstolee pushed a commit that referenced this pull request Oct 30, 2021
Remove sparse index expansions from untracked file stashes
derrickstolee pushed a commit that referenced this pull request Oct 31, 2021
Remove sparse index expansions from untracked file stashes
derrickstolee pushed a commit that referenced this pull request Nov 4, 2021
Remove sparse index expansions from untracked file stashes
derrickstolee pushed a commit that referenced this pull request Nov 4, 2021
Remove sparse index expansions from untracked file stashes
derrickstolee pushed a commit that referenced this pull request Nov 10, 2021
Remove sparse index expansions from untracked file stashes
derrickstolee pushed a commit that referenced this pull request Nov 15, 2021
Remove sparse index expansions from untracked file stashes
ldennington pushed a commit to ldennington/git that referenced this pull request Jan 12, 2022
Remove sparse index expansions from untracked file stashes
ldennington pushed a commit to ldennington/git that referenced this pull request Jan 19, 2022
Remove sparse index expansions from untracked file stashes
ldennington pushed a commit to ldennington/git that referenced this pull request Jan 20, 2022
Remove sparse index expansions from untracked file stashes
ldennington pushed a commit to ldennington/git that referenced this pull request Jan 20, 2022
Remove sparse index expansions from untracked file stashes
ldennington pushed a commit to ldennington/git that referenced this pull request Jan 20, 2022
Remove sparse index expansions from untracked file stashes
ldennington pushed a commit to ldennington/git that referenced this pull request Jan 20, 2022
Remove sparse index expansions from untracked file stashes
ldennington pushed a commit to ldennington/git that referenced this pull request Jan 20, 2022
Remove sparse index expansions from untracked file stashes
ldennington pushed a commit to ldennington/git that referenced this pull request Jan 20, 2022
Remove sparse index expansions from untracked file stashes
ldennington pushed a commit to ldennington/git that referenced this pull request Jan 25, 2022
Remove sparse index expansions from untracked file stashes
ldennington pushed a commit to ldennington/git that referenced this pull request Jan 25, 2022
Remove sparse index expansions from untracked file stashes
dscho pushed a commit that referenced this pull request Feb 1, 2022
Remove sparse index expansions from untracked file stashes
dscho pushed a commit that referenced this pull request Jun 17, 2022
Remove sparse index expansions from untracked file stashes
dscho pushed a commit that referenced this pull request Jun 17, 2022
Remove sparse index expansions from untracked file stashes
dscho pushed a commit that referenced this pull request Jun 17, 2022
Remove sparse index expansions from untracked file stashes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants