Skip to content

Commit bbcefa1

Browse files
peffgitster
authored andcommitted
t/perf: add tests for pack bitmaps
This adds a few basic perf tests for the pack bitmap code to show off its improvements. The tests are: 1. How long does it take to do a repack (it gets slower with bitmaps, since we have to do extra work)? 2. How long does it take to do a clone (it gets faster with bitmaps)? 3. How does a small fetch perform when we've just repacked? 4. How does a clone perform when we haven't repacked since a week of pushes? Here are results against linux.git: Test origin/master this tree ----------------------------------------------------------------------- 5310.2: repack to disk 33.64(32.64+2.04) 67.67(66.75+1.84) +101.2% 5310.3: simulated clone 30.49(29.47+2.05) 1.20(1.10+0.10) -96.1% 5310.4: simulated fetch 3.49(6.79+0.06) 5.57(22.35+0.07) +59.6% 5310.6: partial bitmap 36.70(43.87+1.81) 8.18(21.92+0.73) -77.7% You can see that we do take longer to repack, but we do way better for further clones. A small fetch performs a bit worse, as we spend way more time on delta compression (note the heavy user CPU time, as we have 8 threads) due to the lack of name hashes for the bitmapped objects. The final test shows how the bitmaps degrade over time between packs. There's still a significant speedup over the non-bitmap case, but we don't do quite as well (we have to spend time accessing the "new" objects the old fashioned way, including delta compression). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 212f2ff commit bbcefa1

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

t/perf/p5310-pack-bitmaps.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/sh
2+
3+
test_description='Tests pack performance using bitmaps'
4+
. ./perf-lib.sh
5+
6+
test_perf_large_repo
7+
8+
# note that we do everything through config,
9+
# since we want to be able to compare bitmap-aware
10+
# git versus non-bitmap git
11+
test_expect_success 'setup bitmap config' '
12+
git config pack.writebitmaps true
13+
'
14+
15+
test_perf 'repack to disk' '
16+
git repack -ad
17+
'
18+
19+
test_perf 'simulated clone' '
20+
git pack-objects --stdout --all </dev/null >/dev/null
21+
'
22+
23+
test_perf 'simulated fetch' '
24+
have=$(git rev-list HEAD~100 -1) &&
25+
{
26+
echo HEAD &&
27+
echo ^$have
28+
} | git pack-objects --revs --stdout >/dev/null
29+
'
30+
31+
test_expect_success 'create partial bitmap state' '
32+
# pick a commit to represent the repo tip in the past
33+
cutoff=$(git rev-list HEAD~100 -1) &&
34+
orig_tip=$(git rev-parse HEAD) &&
35+
36+
# now kill off all of the refs and pretend we had
37+
# just the one tip
38+
rm -rf .git/logs .git/refs/* .git/packed-refs
39+
git update-ref HEAD $cutoff
40+
41+
# and then repack, which will leave us with a nice
42+
# big bitmap pack of the "old" history, and all of
43+
# the new history will be loose, as if it had been pushed
44+
# up incrementally and exploded via unpack-objects
45+
git repack -Ad
46+
47+
# and now restore our original tip, as if the pushes
48+
# had happened
49+
git update-ref HEAD $orig_tip
50+
'
51+
52+
test_perf 'partial bitmap' '
53+
git pack-objects --stdout --all </dev/null >/dev/null
54+
'
55+
56+
test_done

0 commit comments

Comments
 (0)