p5310: extract full and partial bitmap tests

A new p5326 introduced by the next patch will want these same tests, interjecting its own setup in between. Move them out so that both perf tests can reuse them. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Taylor Blau committed Aug 31, 2021 at 16:52 UTC 9387fbd6461f0f04aad8401c290282e85965f139
2 files changed +72 -62
t/perf/lib-bitmap.sh new
+69
@@ -0,0 +1,69 @@
1 +# Helper functions for testing bitmap performance; see p5310.
2 +
3 +test_full_bitmap () {
4 + test_perf 'simulated clone' '
5 + git pack-objects --stdout --all </dev/null >/dev/null
6 + '
7 +
8 + test_perf 'simulated fetch' '
9 + have=$(git rev-list HEAD~100 -1) &&
10 + {
11 + echo HEAD &&
12 + echo ^$have
13 + } | git pack-objects --revs --stdout >/dev/null
14 + '
15 +
16 + test_perf 'pack to file (bitmap)' '
17 + git pack-objects --use-bitmap-index --all pack1b </dev/null >/dev/null
18 + '
19 +
20 + test_perf 'rev-list (commits)' '
21 + git rev-list --all --use-bitmap-index >/dev/null
22 + '
23 +
24 + test_perf 'rev-list (objects)' '
25 + git rev-list --all --use-bitmap-index --objects >/dev/null
26 + '
27 +
28 + test_perf 'rev-list with tag negated via --not --all (objects)' '
29 + git rev-list perf-tag --not --all --use-bitmap-index --objects >/dev/null
30 + '
31 +
32 + test_perf 'rev-list with negative tag (objects)' '
33 + git rev-list HEAD --not perf-tag --use-bitmap-index --objects >/dev/null
34 + '
35 +
36 + test_perf 'rev-list count with blob:none' '
37 + git rev-list --use-bitmap-index --count --objects --all \
38 + --filter=blob:none >/dev/null
39 + '
40 +
41 + test_perf 'rev-list count with blob:limit=1k' '
42 + git rev-list --use-bitmap-index --count --objects --all \
43 + --filter=blob:limit=1k >/dev/null
44 + '
45 +
46 + test_perf 'rev-list count with tree:0' '
47 + git rev-list --use-bitmap-index --count --objects --all \
48 + --filter=tree:0 >/dev/null
49 + '
50 +
51 + test_perf 'simulated partial clone' '
52 + git pack-objects --stdout --all --filter=blob:none </dev/null >/dev/null
53 + '
54 +}
55 +
56 +test_partial_bitmap () {
57 + test_perf 'clone (partial bitmap)' '
58 + git pack-objects --stdout --all </dev/null >/dev/null
59 + '
60 +
61 + test_perf 'pack to file (partial bitmap)' '
62 + git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null
63 + '
64 +
65 + test_perf 'rev-list with tree filter (partial bitmap)' '
66 + git rev-list --use-bitmap-index --count --objects --all \
67 + --filter=tree:0 >/dev/null
68 + '
69 +}
t/perf/p5310-pack-bitmaps.sh
+3 -62
@@ -2,6 +2,7 @@
2
3 test_description='Tests pack performance using bitmaps'
4 . ./perf-lib.sh
5 +. "${TEST_DIRECTORY}/perf/lib-bitmap.sh"
6
7 test_perf_large_repo
8
@@ -25,56 +26,7 @@ test_perf 'repack to disk' '
26 git repack -ad
27 '
28
28 -test_perf 'simulated clone' '
29 - git pack-objects --stdout --all </dev/null >/dev/null
30 -'
31 -
32 -test_perf 'simulated fetch' '
33 - have=$(git rev-list HEAD~100 -1) &&
34 - {
35 - echo HEAD &&
36 - echo ^$have
37 - } | git pack-objects --revs --stdout >/dev/null
38 -'
39 -
40 -test_perf 'pack to file (bitmap)' '
41 - git pack-objects --use-bitmap-index --all pack1b </dev/null >/dev/null
42 -'
43 -
44 -test_perf 'rev-list (commits)' '
45 - git rev-list --all --use-bitmap-index >/dev/null
46 -'
47 -
48 -test_perf 'rev-list (objects)' '
49 - git rev-list --all --use-bitmap-index --objects >/dev/null
50 -'
51 -
52 -test_perf 'rev-list with tag negated via --not --all (objects)' '
53 - git rev-list perf-tag --not --all --use-bitmap-index --objects >/dev/null
54 -'
55 -
56 -test_perf 'rev-list with negative tag (objects)' '
57 - git rev-list HEAD --not perf-tag --use-bitmap-index --objects >/dev/null
58 -'
59 -
60 -test_perf 'rev-list count with blob:none' '
61 - git rev-list --use-bitmap-index --count --objects --all \
62 - --filter=blob:none >/dev/null
63 -'
64 -
65 -test_perf 'rev-list count with blob:limit=1k' '
66 - git rev-list --use-bitmap-index --count --objects --all \
67 - --filter=blob:limit=1k >/dev/null
68 -'
69 -
70 -test_perf 'rev-list count with tree:0' '
71 - git rev-list --use-bitmap-index --count --objects --all \
72 - --filter=tree:0 >/dev/null
73 -'
74 -
75 -test_perf 'simulated partial clone' '
76 - git pack-objects --stdout --all --filter=blob:none </dev/null >/dev/null
77 -'
29 +test_full_bitmap
30
31 test_expect_success 'create partial bitmap state' '
32 # pick a commit to represent the repo tip in the past
@@ -97,17 +49,6 @@ test_expect_success 'create partial bitmap state' '
49 git update-ref HEAD $orig_tip
50 '
51
100 -test_perf 'clone (partial bitmap)' '
101 - git pack-objects --stdout --all </dev/null >/dev/null
102 -'
103 -
104 -test_perf 'pack to file (partial bitmap)' '
105 - git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null
106 -'
107 -
108 -test_perf 'rev-list with tree filter (partial bitmap)' '
109 - git rev-list --use-bitmap-index --count --objects --all \
110 - --filter=tree:0 >/dev/null
111 -'
52 +test_partial_bitmap
53
54 test_done