builtin/add: enable fscache around repo_read_index_preload - #899
Merged
Johannes Schindelin (dscho) merged 2 commits intoApr 28, 2026
Merged
Conversation
Johannes Schindelin (dscho)
previously approved these changes
Apr 28, 2026
Johannes Schindelin (dscho)
left a comment
Member
There was a problem hiding this comment.
I will split the commit a bit, and "forge" your SOB.
| enable_fscache(0); | ||
| /* We do not really re-read the index but update the up-to-date flags */ | ||
| preload_index(repo->index, &pathspec, 0); | ||
|
|
There was a problem hiding this comment.
Let's keep this empty line.
| dir_clear(&dir); | ||
| clear_pathspec(&pathspec); | ||
| enable_fscache(0); | ||
| disable_fscache(); |
There was a problem hiding this comment.
Good call. This was missed in 6378e39.
| die_in_unpopulated_submodule(repo->index, prefix); | ||
| die_path_inside_submodule(repo->index, &pathspec); | ||
|
|
||
| enable_fscache(0); |
added 2 commits
April 28, 2026 09:40
Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X Elite, ReFS Dev Drive) shows that the heaviest `lstat()`-bound work in `git add` happens inside `repo_read_index_preload()`, which currently runs *before* `enable_fscache()` is called. Moving the enable up so the preload phase is wrapped lets the existing batched `NtQueryDirectoryFile()` cache cover the bulk of the lstat traffic. Signed-off-by: Anthony Shaw <anthonyshaw@microsoft.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Fix a copy-paste bug at the end of `cmd_add()`: the cleanup site called `enable_fscache(0)` again instead of `disable_fscache()`, leaking the refcount. Harmless in a one-shot process today, but it confuses the matching enable/disable contract that callers and reviewers expect. Signed-off-by: Anthony Shaw <anthonyshaw@microsoft.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Member
|
I will fix the |
Johannes Schindelin (dscho)
force-pushed
the
wsl-fscache-add
branch
from
April 28, 2026 13:28
1bf22fb to
add7a58
Compare
This was referenced Apr 28, 2026
Johannes Schindelin (dscho)
merged commit Apr 28, 2026
9ac4846
into
microsoft:vfs-2.53.0
310 of 316 checks passed
Johannes Schindelin (dscho)
added a commit
that referenced
this pull request
Apr 28, 2026
…`vfs-2.54.0` (#902) This is a companion of #899 and git-for-windows#6216. Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in git add happens inside repo_read_index_preload(), which currently runs before enable_fscache() is called. Moving the enable up so the preload phase is wrapped lets the existing batched NtQueryDirectoryFile cache cover the bulk of the lstat traffic. This patch gave me a ~30% performance improvement on a large git repo with a batched add. Also at the end of cmd_add(): the cleanup site called enable_fscache(0) again instead of disable_fscache(), leaking the refcount.
Johannes Schindelin (dscho)
added a commit
to git-for-windows/git
that referenced
this pull request
Jun 5, 2026
This is a companion of microsoft#899. Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in git add happens inside repo_read_index_preload(), which currently runs before enable_fscache() is called. Moving the enable up so the preload phase is wrapped lets the existing batched NtQueryDirectoryFile cache cover the bulk of the lstat traffic. This patch gave me a ~30% performance improvement on a large git repo with a batched add. Also at the end of cmd_add(): the cleanup site called enable_fscache(0) again instead of disable_fscache(), leaking the refcount.
gitforwindowshelper Bot
pushed a commit
to git-for-windows/git
that referenced
this pull request
Jun 10, 2026
This is a companion of microsoft#899. Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in git add happens inside repo_read_index_preload(), which currently runs before enable_fscache() is called. Moving the enable up so the preload phase is wrapped lets the existing batched NtQueryDirectoryFile cache cover the bulk of the lstat traffic. This patch gave me a ~30% performance improvement on a large git repo with a batched add. Also at the end of cmd_add(): the cleanup site called enable_fscache(0) again instead of disable_fscache(), leaking the refcount.
gitforwindowshelper Bot
pushed a commit
to git-for-windows/git
that referenced
this pull request
Jun 10, 2026
This is a companion of microsoft#899. Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in git add happens inside repo_read_index_preload(), which currently runs before enable_fscache() is called. Moving the enable up so the preload phase is wrapped lets the existing batched NtQueryDirectoryFile cache cover the bulk of the lstat traffic. This patch gave me a ~30% performance improvement on a large git repo with a batched add. Also at the end of cmd_add(): the cleanup site called enable_fscache(0) again instead of disable_fscache(), leaking the refcount.
gitforwindowshelper Bot
pushed a commit
to git-for-windows/git
that referenced
this pull request
Jun 10, 2026
This is a companion of microsoft#899. Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in git add happens inside repo_read_index_preload(), which currently runs before enable_fscache() is called. Moving the enable up so the preload phase is wrapped lets the existing batched NtQueryDirectoryFile cache cover the bulk of the lstat traffic. This patch gave me a ~30% performance improvement on a large git repo with a batched add. Also at the end of cmd_add(): the cleanup site called enable_fscache(0) again instead of disable_fscache(), leaking the refcount.
gitforwindowshelper Bot
pushed a commit
to git-for-windows/git
that referenced
this pull request
Jun 11, 2026
This is a companion of microsoft#899. Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in git add happens inside repo_read_index_preload(), which currently runs before enable_fscache() is called. Moving the enable up so the preload phase is wrapped lets the existing batched NtQueryDirectoryFile cache cover the bulk of the lstat traffic. This patch gave me a ~30% performance improvement on a large git repo with a batched add. Also at the end of cmd_add(): the cleanup site called enable_fscache(0) again instead of disable_fscache(), leaking the refcount.
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.
Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in
git addhappens inside repo_read_index_preload(), which currently runs before enable_fscache() is called. Moving the enable up so the preload phase is wrapped lets the existing batched NtQueryDirectoryFile cache cover the bulk of the lstat traffic. This patch gave me a ~30% performance improvement on a large git repo with a batched add.Also at the end of cmd_add(): the cleanup site called enable_fscache(0) again instead of disable_fscache(), leaking the refcount.