mirror of
https://github.com/git-for-windows/git.git
synced 2026-02-04 03:33:01 -06:00
unpack-trees: enable fscache for sparse-checkout
When updating the skip-worktree bits in the index to align with new values in a sparse-checkout file, Git scans the entire working directory with lstat() calls. In a sparse-checkout, many of these lstat() calls are for paths that do not exist. Enable the fscache feature during this scan. Since enable_fscache() calls nest, the disable_fscache() method decrements a counter and would only clear the cache if that counter reaches zero. In a local test of a repo with ~2.2 million paths, updating the index with git read-tree -m -u HEAD with a sparse-checkout file containing only /.gitattributes improved from 2-3 minutes to ~6 seconds. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
285899f0b0
commit
37f6dfe47a
@ -1823,7 +1823,9 @@ static void mark_new_skip_worktree(struct pattern_list *pl,
|
||||
* 2. Widen worktree according to sparse-checkout file.
|
||||
* Matched entries will have skip_wt_flag cleared (i.e. "in")
|
||||
*/
|
||||
enable_fscache(istate->cache_nr);
|
||||
clear_ce_flags(istate, select_flag, skip_wt_flag, pl, show_progress);
|
||||
disable_fscache();
|
||||
}
|
||||
|
||||
static void populate_from_existing_patterns(struct unpack_trees_options *o,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user