Skip to content

Commit 6c51d79

Browse files
Takuto Ikutadscho
Takuto Ikuta
authored andcommitted
fetch-pack.c: enable fscache for stats under .git/objects
When I do git fetch, git call file stats under .git/objects for each refs. This takes time when there are many refs. By enabling fscache, git takes file stats by directory traversing and that improved the speed of fetch-pack for repository having large number of refs. In my windows workstation, this improves the time of `git fetch` for chromium repository like below. I took stats 3 times. * With this patch TotalSeconds: 9.9825165 TotalSeconds: 9.1862075 TotalSeconds: 10.1956256 Avg: 9.78811653333333 * Without this patch TotalSeconds: 15.8406702 TotalSeconds: 15.6248053 TotalSeconds: 15.2085938 Avg: 15.5580231 Signed-off-by: Takuto Ikuta <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 9fd4aaa commit 6c51d79

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fetch-pack.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,
761761
save_commit_buffer = 0;
762762

763763
trace2_region_enter("fetch-pack", "parse_remote_refs_and_find_cutoff", NULL);
764+
enable_fscache(1);
764765
for (ref = *refs; ref; ref = ref->next) {
765766
struct commit *commit;
766767

@@ -787,6 +788,7 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,
787788
if (!cutoff || cutoff < commit->date)
788789
cutoff = commit->date;
789790
}
791+
enable_fscache(0);
790792
trace2_region_leave("fetch-pack", "parse_remote_refs_and_find_cutoff", NULL);
791793

792794
/*

0 commit comments

Comments
 (0)