Skip to content

Commit d4e6dbd

Browse files
committed
Merge branch 'tb/pack-bitmap-lookup-tables' into jch
Enable lookup tables extension in pack bitmap (and midx bitmap) by default. Comments? * tb/pack-bitmap-lookup-tables: t/perf/lib-bitmap.sh: avoid test_perf during setup t/perf: avoid testing bitmaps without lookup table p5312: removed duplicate performance test script pack-bitmap: write lookup table extension by default
2 parents 070087a + 05ca0d7 commit d4e6dbd

File tree

10 files changed

+111
-172
lines changed

10 files changed

+111
-172
lines changed

Documentation/config/pack.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ pack.writeBitmapLookupTable::
199199
bitmap index (if one is written). This table is used to defer
200200
loading individual bitmaps as late as possible. This can be
201201
beneficial in repositories that have relatively large bitmap
202-
indexes. Defaults to false.
202+
indexes. Defaults to true.
203203

204204
pack.readReverseIndex::
205205
When true, git will read any .rev file(s) that may be available

builtin/multi-pack-index.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
142142
int ret;
143143

144144
opts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;
145+
opts.flags |= MIDX_WRITE_BITMAP_LOOKUP_TABLE;
145146

146147
git_config(git_multi_pack_index_write_config, NULL);
147148

builtin/pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static enum {
250250
WRITE_BITMAP_QUIET,
251251
WRITE_BITMAP_TRUE,
252252
} write_bitmap_index;
253-
static uint16_t write_bitmap_options = BITMAP_OPT_HASH_CACHE;
253+
static uint16_t write_bitmap_options = BITMAP_OPT_HASH_CACHE | BITMAP_OPT_LOOKUP_TABLE;
254254

255255
static int exclude_promisor_objects;
256256
static int exclude_promisor_objects_best_effort;

t/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,6 @@ benchmarks = [
11311131
'perf/p5304-prune.sh',
11321132
'perf/p5310-pack-bitmaps.sh',
11331133
'perf/p5311-pack-bitmaps-fetch.sh',
1134-
'perf/p5312-pack-bitmaps-revs.sh',
11351134
'perf/p5313-pack-objects.sh',
11361135
'perf/p5314-name-hash.sh',
11371136
'perf/p5326-multi-pack-bitmaps.sh',

t/perf/lib-bitmap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ test_partial_bitmap () {
6969
}
7070

7171
test_pack_bitmap () {
72-
test_perf "repack to disk" '
72+
test_expect_success "repack to disk" '
7373
git repack -ad
7474
'
7575

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/p5312-pack-bitmaps-revs.sh

Lines changed: 0 additions & 34 deletions
This file was deleted.

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)