Skip to content

Commit 0a11e40

Browse files
peffgitster
authored andcommitted
t/perf/lib-pack: use fast-import checkpoint to create packs
We currently use fast-import only to create a large number of objects, and then run O(n) invocations of pack-objects to turn them into packs. We can do this faster by just asking fast-import to checkpoint and create a pack for each (after telling it not to turn loose tiny packs). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aa338d3 commit 0a11e40

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

t/perf/lib-pack.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,17 @@ create_packs () {
99
print "data <<EOF";
1010
print "$_";
1111
print "EOF";
12+
print "checkpoint"
1213
}
1314
' "$@" |
14-
git fast-import &&
15-
16-
git cat-file --batch-all-objects --batch-check='%(objectname)' |
17-
while read sha1
18-
do
19-
echo $sha1 | git pack-objects .git/objects/pack/pack
20-
done
15+
git fast-import
2116
}
2217

2318
# create a large number of packs, disabling any gc which might
2419
# cause us to repack them
2520
setup_many_packs () {
2621
git config gc.auto 0 &&
2722
git config gc.autopacklimit 0 &&
23+
git config fastimport.unpacklimit 0 &&
2824
create_packs 500
2925
}

0 commit comments

Comments
 (0)