Skip to content

Commit 14b6741

Browse files
jeffhostetlerGit for Windows Build Agent
authored andcommitted
preload-index: avoid lstat for skip-worktree items
Teach preload-index to avoid lstat() calls for index-entries with skip-worktree bit set. This is a performance optimization. During a sparse-checkout, the skip-worktree bit is set on items that were not populated and therefore are not present in the worktree. The per-thread preload-index loop performs a series of tests on each index-entry as it attempts to compare the worktree version with the index and mark them up-to-date. This patch short-cuts that work. On a Windows 10 system with a very large repo (450MB index) and various levels of sparseness, performance was improved in the {preloadindex=true, fscache=false} case by 80% and in the {preloadindex=true, fscache=true} case by 20% for various commands. Signed-off-by: Jeff Hostetler <[email protected]>
1 parent 25d76f3 commit 14b6741

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

preload-index.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ static void *preload_thread(void *_data)
5353
continue;
5454
if (ce_uptodate(ce))
5555
continue;
56+
if (ce_skip_worktree(ce))
57+
continue;
5658
if (!ce_path_match(ce, &p->pathspec, NULL))
5759
continue;
5860
if (threaded_has_symlink_leading_path(&cache, ce->name, ce_namelen(ce)))

0 commit comments

Comments
 (0)