Skip to content

Commit d431660

Browse files
peffgitster
authored andcommitted
pack-objects: default to writing bitmap hash-cache
Enabling pack.writebitmaphashcache should always be a performance win. It costs only 4 bytes per object on disk, and the timings in ae4f07f (pack-bitmap: implement optional name_hash cache, 2013-12-21) show it improving fetch and partial-bitmap clone times by 40-50%. The only reason we didn't enable it by default at the time is that early versions of JGit's bitmap reader complained about the presence of optional header bits it didn't understand. But that was changed in JGit's d2fa3987a (Use bitcheck to check for presence of OPT_FULL option, 2013-10-30), which made it into JGit v3.5.0 in late 2014. So let's turn this option on by default. It's backwards-compatible with all versions of Git, and if you are also using JGit on the same repository, you'd only run into problems using a version that's almost 5 years old. We'll drop the manual setting from all of our test scripts, including perf tests. This isn't strictly necessary, but it has two advantages: 1. If the hash-cache ever stops being enabled by default, our perf regression tests will notice. 2. We can use the modified perf tests to show off the behavior of an otherwise unconfigured repo, as shown below. These are the results of a few of a perf tests against linux.git that showed interesting results. You can see the expected speedup in 5310.4, which was noted in ae4f07f. Curiously, 5310.8 did not improve (and actually got slower), despite seeing the opposite in ae4f07f. I don't have an explanation for that. The tests from p5311 did not exist back then, but do show improvements (a smaller pack due to better deltas, which we found in less time). Test HEAD^ HEAD ------------------------------------------------------------------------------------- 5310.4: simulated fetch 7.39(22.70+0.25) 5.64(11.43+0.22) -23.7% 5310.8: clone (partial bitmap) 18.45(24.83+1.19) 19.94(28.40+1.36) +8.1% 5311.31: server (128 days) 0.41(1.13+0.05) 0.34(0.72+0.02) -17.1% 5311.32: size (128 days) 7.4M 7.0M -4.8% 5311.33: client (128 days) 1.33(1.49+0.06) 1.29(1.37+0.12) -3.0% Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 90ca149 commit d431660

File tree

5 files changed

+4
-9
lines changed

5 files changed

+4
-9
lines changed

Documentation/config/pack.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,4 @@ pack.writeBitmapHashCache::
124124
bitmapped and non-bitmapped objects (e.g., when serving a fetch
125125
between an older, bitmapped pack and objects that have been
126126
pushed since the last gc). The downside is that it consumes 4
127-
bytes per object of disk space, and that JGit's bitmap
128-
implementation does not understand it, causing it to complain if
129-
Git and JGit are used on the same repository. Defaults to false.
127+
bytes per object of disk space. Defaults to true.

builtin/pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static off_t reuse_packfile_offset;
9797
static int use_bitmap_index_default = 1;
9898
static int use_bitmap_index = -1;
9999
static int write_bitmap_index;
100-
static uint16_t write_bitmap_options;
100+
static uint16_t write_bitmap_options = BITMAP_OPT_HASH_CACHE;
101101

102102
static int exclude_promisor_objects;
103103

t/perf/p5310-pack-bitmaps.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ test_perf_large_repo
1212
# We intentionally use the deprecated pack.writebitmaps
1313
# config so that we can test against older versions of git.
1414
test_expect_success 'setup bitmap config' '
15-
git config pack.writebitmaps true &&
16-
git config pack.writebitmaphashcache true
15+
git config pack.writebitmaps true
1716
'
1817

1918
test_perf 'repack to disk' '

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ test_perf_default_repo
77

88
test_expect_success 'create bitmapped server repo' '
99
git config pack.writebitmaps true &&
10-
git config pack.writebitmaphashcache true &&
1110
git repack -ad
1211
'
1312

t/t5310-pack-bitmaps.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ test_expect_success 'setup repo with moderate-sized history' '
3434
bitmaptip=$(git rev-parse master) &&
3535
blob=$(echo tagged-blob | git hash-object -w --stdin) &&
3636
git tag tagged-blob $blob &&
37-
git config repack.writebitmaps true &&
38-
git config pack.writebitmaphashcache true
37+
git config repack.writebitmaps true
3938
'
4039

4140
test_expect_success 'full repack creates bitmaps' '

0 commit comments

Comments
 (0)