Skip to content

Commit 6a54159

Browse files
Takuto IkutaGit for Windows Build Agent
Takuto Ikuta
authored and
Git for Windows Build Agent
committed
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]>
1 parent a3cf375 commit 6a54159

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
@@ -713,6 +713,7 @@ static int everything_local(struct fetch_pack_args *args,
713713

714714
save_commit_buffer = 0;
715715

716+
enable_fscache(1);
716717
for (ref = *refs; ref; ref = ref->next) {
717718
struct object *o;
718719

@@ -734,6 +735,7 @@ static int everything_local(struct fetch_pack_args *args,
734735
cutoff = commit->date;
735736
}
736737
}
738+
enable_fscache(0);
737739

738740
if (!args->deepen) {
739741
for_each_ref(mark_complete_oid, NULL);

0 commit comments

Comments
 (0)