mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
![Jeff King](/assets/img/avatar_default.png)
Enabling pack.writebitmaphashcache should always be a performance win. It costs only 4 bytes per object on disk, and the timings inae4f07fbcc
(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 inae4f07fbcc
. Curiously, 5310.8 did not improve (and actually got slower), despite seeing the opposite inae4f07fbcc
. 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>
72 lines
1.8 KiB
Bash
Executable file
72 lines
1.8 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='Tests pack performance using bitmaps'
|
|
. ./perf-lib.sh
|
|
|
|
test_perf_large_repo
|
|
|
|
# note that we do everything through config,
|
|
# since we want to be able to compare bitmap-aware
|
|
# git versus non-bitmap git
|
|
#
|
|
# We intentionally use the deprecated pack.writebitmaps
|
|
# config so that we can test against older versions of git.
|
|
test_expect_success 'setup bitmap config' '
|
|
git config pack.writebitmaps true
|
|
'
|
|
|
|
test_perf 'repack to disk' '
|
|
git repack -ad
|
|
'
|
|
|
|
test_perf 'simulated clone' '
|
|
git pack-objects --stdout --all </dev/null >/dev/null
|
|
'
|
|
|
|
test_perf 'simulated fetch' '
|
|
have=$(git rev-list HEAD~100 -1) &&
|
|
{
|
|
echo HEAD &&
|
|
echo ^$have
|
|
} | git pack-objects --revs --stdout >/dev/null
|
|
'
|
|
|
|
test_perf 'pack to file' '
|
|
git pack-objects --all pack1 </dev/null >/dev/null
|
|
'
|
|
|
|
test_perf 'pack to file (bitmap)' '
|
|
git pack-objects --use-bitmap-index --all pack1b </dev/null >/dev/null
|
|
'
|
|
|
|
test_expect_success 'create partial bitmap state' '
|
|
# pick a commit to represent the repo tip in the past
|
|
cutoff=$(git rev-list HEAD~100 -1) &&
|
|
orig_tip=$(git rev-parse HEAD) &&
|
|
|
|
# now kill off all of the refs and pretend we had
|
|
# just the one tip
|
|
rm -rf .git/logs .git/refs/* .git/packed-refs &&
|
|
git update-ref HEAD $cutoff &&
|
|
|
|
# and then repack, which will leave us with a nice
|
|
# big bitmap pack of the "old" history, and all of
|
|
# the new history will be loose, as if it had been pushed
|
|
# up incrementally and exploded via unpack-objects
|
|
git repack -Ad &&
|
|
|
|
# and now restore our original tip, as if the pushes
|
|
# had happened
|
|
git update-ref HEAD $orig_tip
|
|
'
|
|
|
|
test_perf 'clone (partial bitmap)' '
|
|
git pack-objects --stdout --all </dev/null >/dev/null
|
|
'
|
|
|
|
test_perf 'pack to file (partial bitmap)' '
|
|
git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null
|
|
'
|
|
|
|
test_done
|