Skip to content

Commit 9d4f8eb

Browse files
benpeartGit for Windows Build Agent
authored andcommitted
Enable the filesystem cache (fscache) in refresh_index().
On file systems that support it, this can dramatically speed up operations like add, commit, describe, rebase, reset, rm that would otherwise have to lstat() every file to "re-match" the stat information in the index to that of the file system. On a synthetic repo with 1M files, "git reset" dropped from 52.02 seconds to 14.42 seconds for a savings of 72%. Signed-off-by: Ben Peart <benpeart@microsoft.com>
1 parent b7b9490 commit 9d4f8eb

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

read-cache.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,6 +1516,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
15161516
typechange_fmt = in_porcelain ? "T\t%s\n" : "%s: needs update\n";
15171517
added_fmt = in_porcelain ? "A\t%s\n" : "%s: needs update\n";
15181518
unmerged_fmt = in_porcelain ? "U\t%s\n" : "%s: needs merge\n";
1519+
enable_fscache(1);
15191520
/*
15201521
* Use the multi-threaded preload_index() to refresh most of the
15211522
* cache entries quickly then in the single threaded loop below,
@@ -1610,6 +1611,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
16101611
display_progress(progress, istate->cache_nr);
16111612
stop_progress(&progress);
16121613
trace_performance_leave("refresh index");
1614+
enable_fscache(0);
16131615
return has_errors;
16141616
}
16151617

0 commit comments

Comments
 (0)