Skip to content

Commit 8fe910f

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 <tikuta@chromium.org>
1 parent 89ad8fd commit 8fe910f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fetch-pack.c

+2
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ static int everything_local(struct fetch_pack_args *args,
722722

723723
save_commit_buffer = 0;
724724

725+
enable_fscache(1);
725726
for (ref = *refs; ref; ref = ref->next) {
726727
struct object *o;
727728

@@ -743,6 +744,7 @@ static int everything_local(struct fetch_pack_args *args,
743744
cutoff = commit->date;
744745
}
745746
}
747+
enable_fscache(0);
746748

747749
if (!args->no_dependents) {
748750
if (!args->deepen) {

0 commit comments

Comments
 (0)