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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Nov 20, 2017 at 15:27 UTC 0a11e40275b445fcc959a0dc05f8d73a5a9cbf36
1 file changed +3 -7
t/perf/lib-pack.sh
+3 -7
@@ -9,15 +9,10 @@ create_packs () {
9 print "data <<EOF";
10 print "$_";
11 print "EOF";
12 + print "checkpoint"
13 }
14 ' "$@" |
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
16 }
17
18 # create a large number of packs, disabling any gc which might
@@ -25,5 +20,6 @@ create_packs () {
20 setup_many_packs () {
21 git config gc.auto 0 &&
22 git config gc.autopacklimit 0 &&
23 + git config fastimport.unpacklimit 0 &&
24 create_packs 500
25 }