Skip to content

Commit c9d41a4

Browse files
ttaylorrgitster
authored andcommitted
t/perf: avoid testing bitmaps without lookup table
In a previous commit, the setting which controls whether or not the pack- and MIDX-bitmap machinery writes a lookup table, 'pack.writeBitmapLookupTable' was enabled by default. As a result, we can clean up many of our bitmap-related performance tests. Many of the relevant performance tests look something like: test_it () { test_expect_success 'setup pack.writeBitmapLookupTable' ' git config pack.writeBitmapLookupTable '"$1"' ' # ... } test_it true test_it false , where the two invocations of 'test_it' run the tests with and without bitmap lookup tables enabled. But now that lookup tables are enabled by default and have proven to be a performance win, let's avoid benchmarking what is now an uncommon and non-default scenario. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8b0b5c7 commit c9d41a4

File tree

4 files changed

+107
-134
lines changed

4 files changed

+107
-134
lines changed

t/perf/p5310-pack-bitmaps.sh

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,28 @@ test_description='Tests pack performance using bitmaps'
44
. ./perf-lib.sh
55
. "${TEST_DIRECTORY}/perf/lib-bitmap.sh"
66

7-
test_lookup_pack_bitmap () {
8-
test_expect_success 'start the test from scratch' '
9-
rm -rf * .git
10-
'
11-
12-
test_perf_large_repo
13-
14-
# note that we do everything through config,
15-
# since we want to be able to compare bitmap-aware
16-
# git versus non-bitmap git
17-
#
18-
# We intentionally use the deprecated pack.writebitmaps
19-
# config so that we can test against older versions of git.
20-
test_expect_success 'setup bitmap config' '
21-
git config pack.writebitmaps true
22-
'
23-
24-
# we need to create the tag up front such that it is covered by the repack and
25-
# thus by generated bitmaps.
26-
test_expect_success 'create tags' '
27-
git tag --message="tag pointing to HEAD" perf-tag HEAD
28-
'
29-
30-
test_perf "enable lookup table: $1" '
31-
git config pack.writeBitmapLookupTable '"$1"'
32-
'
33-
34-
test_pack_bitmap
35-
}
36-
37-
test_lookup_pack_bitmap false
38-
test_lookup_pack_bitmap true
7+
test_expect_success 'start the test from scratch' '
8+
rm -rf * .git
9+
'
10+
11+
test_perf_large_repo
12+
13+
# note that we do everything through config,
14+
# since we want to be able to compare bitmap-aware
15+
# git versus non-bitmap git
16+
#
17+
# We intentionally use the deprecated pack.writebitmaps
18+
# config so that we can test against older versions of git.
19+
test_expect_success 'setup bitmap config' '
20+
git config pack.writebitmaps true
21+
'
22+
23+
# we need to create the tag up front such that it is covered by the repack and
24+
# thus by generated bitmaps.
25+
test_expect_success 'create tags' '
26+
git tag --message="tag pointing to HEAD" perf-tag HEAD
27+
'
28+
29+
test_pack_bitmap
3930

4031
test_done

t/perf/p5311-pack-bitmaps-fetch.sh

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,46 @@
33
test_description='performance of fetches from bitmapped packs'
44
. ./perf-lib.sh
55

6-
test_fetch_bitmaps () {
7-
test_expect_success 'setup test directory' '
8-
rm -fr * .git
6+
test_expect_success 'setup test directory' '
7+
rm -fr * .git
8+
'
9+
10+
test_perf_default_repo
11+
12+
test_expect_success 'create bitmapped server repo' '
13+
git config pack.writebitmaps true &&
14+
git repack -ad
15+
'
16+
17+
# simulate a fetch from a repository that last fetched N days ago, for
18+
# various values of N. We do so by following the first-parent chain,
19+
# and assume the first entry in the chain that is N days older than the current
20+
# HEAD is where the HEAD would have been then.
21+
for days in 1 2 4 8 16 32 64 128; do
22+
title=$(printf '%10s' "($days days)")
23+
test_expect_success "setup revs from $days days ago" '
24+
now=$(git log -1 --format=%ct HEAD) &&
25+
then=$(($now - ($days * 86400))) &&
26+
tip=$(git rev-list -1 --first-parent --until=$then HEAD) &&
27+
{
28+
echo HEAD &&
29+
echo ^$tip
30+
} >revs
931
'
1032

11-
test_perf_default_repo
33+
test_perf "server $title" '
34+
git pack-objects --stdout --revs \
35+
--thin --delta-base-offset \
36+
<revs >tmp.pack
37+
'
1238

13-
test_expect_success 'create bitmapped server repo' '
14-
git config pack.writebitmaps true &&
15-
git config pack.writeBitmapLookupTable '"$1"' &&
16-
git repack -ad
39+
test_size "size $title" '
40+
test_file_size tmp.pack
1741
'
1842

19-
# simulate a fetch from a repository that last fetched N days ago, for
20-
# various values of N. We do so by following the first-parent chain,
21-
# and assume the first entry in the chain that is N days older than the current
22-
# HEAD is where the HEAD would have been then.
23-
for days in 1 2 4 8 16 32 64 128; do
24-
title=$(printf '%10s' "($days days)")
25-
test_expect_success "setup revs from $days days ago" '
26-
now=$(git log -1 --format=%ct HEAD) &&
27-
then=$(($now - ($days * 86400))) &&
28-
tip=$(git rev-list -1 --first-parent --until=$then HEAD) &&
29-
{
30-
echo HEAD &&
31-
echo ^$tip
32-
} >revs
33-
'
34-
35-
test_perf "server $title (lookup=$1)" '
36-
git pack-objects --stdout --revs \
37-
--thin --delta-base-offset \
38-
<revs >tmp.pack
39-
'
40-
41-
test_size "size $title" '
42-
test_file_size tmp.pack
43-
'
44-
45-
test_perf "client $title (lookup=$1)" '
46-
git index-pack --stdin --fix-thin <tmp.pack
47-
'
48-
done
49-
}
50-
51-
test_fetch_bitmaps true
52-
test_fetch_bitmaps false
43+
test_perf "client $title" '
44+
git index-pack --stdin --fix-thin <tmp.pack
45+
'
46+
done
5347

5448
test_done

t/perf/p5326-multi-pack-bitmaps.sh

Lines changed: 48 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -4,64 +4,53 @@ test_description='Tests performance using midx bitmaps'
44
. ./perf-lib.sh
55
. "${TEST_DIRECTORY}/perf/lib-bitmap.sh"
66

7-
test_bitmap () {
8-
local enabled="$1"
9-
10-
test_expect_success "remove existing repo (lookup=$enabled)" '
11-
rm -fr * .git
12-
'
13-
14-
test_perf_large_repo
15-
16-
# we need to create the tag up front such that it is covered by the repack and
17-
# thus by generated bitmaps.
18-
test_expect_success 'create tags' '
19-
git tag --message="tag pointing to HEAD" perf-tag HEAD
20-
'
21-
22-
test_expect_success "use lookup table: $enabled" '
23-
git config pack.writeBitmapLookupTable '"$enabled"'
24-
'
25-
26-
test_expect_success "start with bitmapped pack (lookup=$enabled)" '
27-
git repack -adb
28-
'
29-
30-
test_perf "setup multi-pack index (lookup=$enabled)" '
31-
git multi-pack-index write --bitmap
32-
'
33-
34-
test_expect_success "drop pack bitmap (lookup=$enabled)" '
35-
rm -f .git/objects/pack/pack-*.bitmap
36-
'
37-
38-
test_full_bitmap
39-
40-
test_expect_success "create partial bitmap state (lookup=$enabled)" '
41-
# pick a commit to represent the repo tip in the past
42-
cutoff=$(git rev-list HEAD~100 -1) &&
43-
orig_tip=$(git rev-parse HEAD) &&
44-
45-
# now pretend we have just one tip
46-
rm -rf .git/logs .git/refs/* .git/packed-refs &&
47-
git update-ref HEAD $cutoff &&
48-
49-
# and then repack, which will leave us with a nice
50-
# big bitmap pack of the "old" history, and all of
51-
# the new history will be loose, as if it had been pushed
52-
# up incrementally and exploded via unpack-objects
53-
git repack -Ad &&
54-
git multi-pack-index write --bitmap &&
55-
56-
# and now restore our original tip, as if the pushes
57-
# had happened
58-
git update-ref HEAD $orig_tip
59-
'
60-
61-
test_partial_bitmap
62-
}
63-
64-
test_bitmap false
65-
test_bitmap true
7+
test_expect_success "remove existing repo" '
8+
rm -fr * .git
9+
'
10+
11+
test_perf_large_repo
12+
13+
# we need to create the tag up front such that it is covered by the repack and
14+
# thus by generated bitmaps.
15+
test_expect_success 'create tags' '
16+
git tag --message="tag pointing to HEAD" perf-tag HEAD
17+
'
18+
19+
test_expect_success "start with bitmapped pack" '
20+
git repack -adb
21+
'
22+
23+
test_perf "setup multi-pack index" '
24+
git multi-pack-index write --bitmap
25+
'
26+
27+
test_expect_success "drop pack bitmap" '
28+
rm -f .git/objects/pack/pack-*.bitmap
29+
'
30+
31+
test_full_bitmap
32+
33+
test_expect_success "create partial bitmap state" '
34+
# pick a commit to represent the repo tip in the past
35+
cutoff=$(git rev-list HEAD~100 -1) &&
36+
orig_tip=$(git rev-parse HEAD) &&
37+
38+
# now pretend we have just one tip
39+
rm -rf .git/logs .git/refs/* .git/packed-refs &&
40+
git update-ref HEAD $cutoff &&
41+
42+
# and then repack, which will leave us with a nice
43+
# big bitmap pack of the "old" history, and all of
44+
# the new history will be loose, as if it had been pushed
45+
# up incrementally and exploded via unpack-objects
46+
git repack -Ad &&
47+
git multi-pack-index write --bitmap &&
48+
49+
# and now restore our original tip, as if the pushes
50+
# had happened
51+
git update-ref HEAD $orig_tip
52+
'
53+
54+
test_partial_bitmap
6655

6756
test_done

t/perf/p5333-pseudo-merge-bitmaps.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ test_expect_success 'setup' '
1111
-c bitmapPseudoMerge.all.threshold=now \
1212
-c bitmapPseudoMerge.all.stableThreshold=never \
1313
-c bitmapPseudoMerge.all.maxMerges=64 \
14-
-c pack.writeBitmapLookupTable=true \
1514
repack -adb
1615
'
1716

0 commit comments

Comments
 (0)