]> git.ipfire.org Git - thirdparty/git.git/blob - t/perf/p5311-pack-bitmaps-fetch.sh
Merge branch 'jk/clone-allow-bare-and-o-together'
[thirdparty/git.git] / t / perf / p5311-pack-bitmaps-fetch.sh
1 #!/bin/sh
2
3 test_description='performance of fetches from bitmapped packs'
4 . ./perf-lib.sh
5
6 test_fetch_bitmaps () {
7 test_expect_success 'setup test directory' '
8 rm -fr * .git
9 '
10
11 test_perf_default_repo
12
13 test_expect_success 'create bitmapped server repo' '
14 git config pack.writebitmaps true &&
15 git config pack.writeBitmapLookupTable '"$1"' &&
16 git repack -ad
17 '
18
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 wc -c <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
53
54 test_done