p5550: factor out nonsense-pack creation
We have a function to create a bunch of irrelevant packs to measure the expense of reprepare_packed_git(). Let's make that available to other perf scripts. 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:26 UTC
aa338d35087fdfc268d6f386a40464056acc6237
2 files changed
+31
-23
t/perf/lib-pack.sh
new
+29
@@ -0,0 +1,29 @@
1
+# Helpers for dealing with large numbers of packs.
2
+
3
+# create $1 nonsense packs, each with a single blob
4
+create_packs () {
5
+ perl -le '
6
+ my ($n) = @ARGV;
7
+ for (1..$n) {
8
+ print "blob";
9
+ print "data <<EOF";
10
+ print "$_";
11
+ print "EOF";
12
+ }
13
+ ' "$@" |
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
21
+}
22
+
23
+# create a large number of packs, disabling any gc which might
24
+# cause us to repack them
25
+setup_many_packs () {
26
+ git config gc.auto 0 &&
27
+ git config gc.autopacklimit 0 &&
28
+ create_packs 500
29
+}
t/perf/p5550-fetch-tags.sh
+2
-23
@@ -20,6 +20,7 @@ start to show a noticeable performance problem on my machine, but without
20
taking too long to set up and run the tests.
21
'
22
. ./perf-lib.sh
23
+. "$TEST_DIRECTORY/perf/lib-pack.sh"
24
25
# make a long nonsense history on branch $1, consisting of $2 commits, each
26
# with a unique file pointing to the blob at $2.
@@ -44,26 +45,6 @@ create_tags () {
45
git update-ref --stdin
46
}
47
47
-# create $1 nonsense packs, each with a single blob
48
-create_packs () {
49
- perl -le '
50
- my ($n) = @ARGV;
51
- for (1..$n) {
52
- print "blob";
53
- print "data <<EOF";
54
- print "$_";
55
- print "EOF";
56
- }
57
- ' "$@" |
58
- git fast-import &&
59
-
60
- git cat-file --batch-all-objects --batch-check='%(objectname)' |
61
- while read sha1
62
- do
63
- echo $sha1 | git pack-objects .git/objects/pack/pack
64
- done
65
-}
66
-
48
test_expect_success 'create parent and child' '
49
git init parent &&
50
git -C parent commit --allow-empty -m base &&
@@ -84,9 +65,7 @@ test_expect_success 'populate parent tags' '
65
test_expect_success 'create child packs' '
66
(
67
cd child &&
87
- git config gc.auto 0 &&
88
- git config gc.autopacklimit 0 &&
89
- create_packs 500
68
+ setup_many_packs
69
)
70
'
71