Skip to content

Commit e49e7c5

Browse files
derrickstoleedscho
authored andcommitted
p5313: add size comparison test
As custom options are added to 'git pack-objects' and 'git repack' to adjust how compression is done, use this new performance test script to demonstrate their effectiveness in performance and size. The recently-added --full-name-hash option swaps the default name-hash algorithm with one that attempts to uniformly distribute the hashes based on the full path name instead of the last 16 characters. This has a dramatic effect on full repacks for repositories with many versions of most paths. It can have a negative impact on cases such as pushing a single change. This can be seen by running pt5313 on the open source fluentui repository [1]. Most commits will have this kind of output for the thin and big pack cases, though certain commits (such as [2]) will have problematic thin pack size for other reasons. [1] https://github.com/microsoft/fluentui [2] a637a06df05360ce5ff21420803f64608226a875 Checked out at the parent of [2], I see the following statistics: Test this tree ------------------------------------------------------------------ 5313.2: thin pack 0.02(0.01+0.01) 5313.3: thin pack size 1.1K 5313.4: thin pack with --full-name-hash 0.02(0.01+0.00) 5313.5: thin pack size with --full-name-hash 3.0K 5313.6: big pack 1.65(3.35+0.24) 5313.7: big pack size 58.0M 5313.8: big pack with --full-name-hash 1.53(2.52+0.18) 5313.9: big pack size with --full-name-hash 57.6M 5313.10: repack 176.52(706.60+3.53) 5313.11: repack size 446.7K 5313.12: repack with --full-name-hash 37.47(134.18+3.06) 5313.13: repack size with --full-name-hash 183.1K Note that this demonstrates a 3x size _increase_ in the case that simulates a small "git push". The size change is neutral on the case of pushing the difference between HEAD and HEAD~1000. However, the full repack case is both faster and more efficient. Signed-off-by: Derrick Stolee <[email protected]>
1 parent d03abf2 commit e49e7c5

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

t/perf/p5313-pack-objects.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/sh
2+
3+
test_description='Tests pack performance using bitmaps'
4+
. ./perf-lib.sh
5+
6+
GIT_TEST_PASSING_SANITIZE_LEAK=0
7+
export GIT_TEST_PASSING_SANITIZE_LEAK
8+
9+
test_perf_large_repo
10+
11+
test_expect_success 'create rev input' '
12+
cat >in-thin <<-EOF &&
13+
$(git rev-parse HEAD)
14+
^$(git rev-parse HEAD~1)
15+
EOF
16+
17+
cat >in-big <<-EOF
18+
$(git rev-parse HEAD)
19+
^$(git rev-parse HEAD~1000)
20+
EOF
21+
'
22+
23+
test_perf 'thin pack' '
24+
git pack-objects --thin --stdout --revs --sparse <in-thin >out
25+
'
26+
27+
test_size 'thin pack size' '
28+
test_file_size out
29+
'
30+
31+
test_perf 'thin pack with --full-name-hash' '
32+
git pack-objects --thin --stdout --revs --sparse --full-name-hash <in-thin >out
33+
'
34+
35+
test_size 'thin pack size with --full-name-hash' '
36+
test_file_size out
37+
'
38+
39+
test_perf 'big pack' '
40+
git pack-objects --stdout --revs --sparse <in-big >out
41+
'
42+
43+
test_size 'big pack size' '
44+
test_file_size out
45+
'
46+
47+
test_perf 'big pack with --full-name-hash' '
48+
git pack-objects --stdout --revs --sparse --full-name-hash <in-big >out
49+
'
50+
51+
test_size 'big pack size with --full-name-hash' '
52+
test_file_size out
53+
'
54+
55+
test_perf 'repack' '
56+
git repack -adf
57+
'
58+
59+
test_size 'repack size' '
60+
pack=$(ls .git/objects/pack/pack-*.pack) &&
61+
test_file_size "$pack"
62+
'
63+
64+
test_perf 'repack with --full-name-hash' '
65+
git repack -adf --full-name-hash
66+
'
67+
68+
test_size 'repack size with --full-name-hash' '
69+
pack=$(ls .git/objects/pack/pack-*.pack) &&
70+
test_file_size "$pack"
71+
'
72+
73+
test_done

0 commit comments

Comments
 (0)