Skip to content

Commit

Permalink
preload-index: avoid lstat for skip-worktree items
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jeffhostetler authored and Git for Windows Build Agent committed Mar 16, 2017
1 parent 9285bdb commit e2f984c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions preload-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ static void *preload_thread(void *_data)
continue;
if (ce_uptodate(ce))
continue;
if (ce_skip_worktree(ce))
continue;
if (!ce_path_match(ce, &p->pathspec, NULL))
continue;
if (threaded_has_symlink_leading_path(&cache, ce->name, ce_namelen(ce)))
Expand Down

0 comments on commit e2f984c

Please sign in to comment.