3 test_description='performance with large numbers of packs'
8 # A real many-pack situation would probably come from having a lot of pushes
9 # over time. We don't know how big each push would be, but we can fake it by
10 # just walking the first-parent chain and having every 5 commits be their own
11 # "push". This isn't _entirely_ accurate, as real pushes would have some
12 # duplicate objects due to thin-pack fixing, but it's a reasonable
15 # And then all of the rest of the objects can go in a single packfile that
16 # represents the state before any of those pushes (actually, we'll generate
17 # that first because in such a setup it would be the oldest pack, and we sort
18 # the packs by reverse mtime inside git).
23 git rev-list --first-parent HEAD |
26 perl -e 'print reverse <>' \
29 # create base packfile
31 git pack-objects --delta-base-offset --revs staging/pack
33 # and then incrementals between each pair of commits
37 if test -n "$last"; then
42 git pack-objects --delta-base-offset --revs \
43 staging/pack || return 1
48 # and install the whole thing
49 rm -f .git/objects/pack/* &&
50 mv staging/* .git/objects/pack/
53 # Pretend we just have a single branch and no reflogs, and that everything is
54 # in objects/pack; that makes our fake pack-building via repack_into_n()
56 test_expect_success 'simplify reachability' '
57 tip=$(git rev-parse --verify HEAD) &&
58 git for-each-ref --format="option no-deref%0adelete %(refname)" |
59 git update-ref --stdin &&
61 git update-ref refs/heads/master $tip &&
62 git symbolic-ref HEAD refs/heads/master &&
66 for nr_packs in 1 50 1000
68 test_expect_success "create $nr_packs-pack scenario" '
69 repack_into_n $nr_packs
72 test_perf "rev-list ($nr_packs)" '
73 git rev-list --objects --all >/dev/null
76 test_perf "abbrev-commit ($nr_packs)" '
77 git rev-list --abbrev-commit HEAD >/dev/null
80 # This simulates the interesting part of the repack, which is the
81 # actual pack generation, without smudging the on-disk setup
83 test_perf "repack ($nr_packs)" '
84 GIT_TEST_FULL_IN_PACK_ARRAY=1 \
85 git pack-objects --keep-true-parents \
86 --honor-pack-keep --non-empty --all \
87 --reflog --indexed-objects --delta-base-offset \
88 --stdout </dev/null >/dev/null
92 # Measure pack loading with 10,000 packs.
93 test_expect_success 'generate lots of packs' '
94 for i in $(test_seq 10000); do
101 git -c fastimport.unpackLimit=0 fast-import
104 # The purpose of this test is to evaluate load time for a large number
105 # of packs while doing as little other work as possible.
106 test_perf "load 10,000 packs" '
107 git rev-parse --verify "HEAD^{commit}"