| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='performance of fetches from bitmapped packs' |
| 4 | . ./perf-lib.sh |
| 5 | |
| 6 | test_fetch_bitmaps () { |
| 7 | argv=$1 |
| 8 | export argv |
| 9 | |
| 10 | test_expect_success 'setup test directory' ' |
| 11 | rm -fr * .git |
| 12 | ' |
| 13 | |
| 14 | test_perf_default_repo |
| 15 | |
| 16 | test_expect_success "create bitmapped server repo ${argv:+($argv)}" ' |
| 17 | git config pack.writebitmaps true && |
| 18 | git repack -adF $argv |
| 19 | ' |
| 20 | |
| 21 | test_size "size of bitmapped pack ${argv:+($argv)}" ' |
| 22 | test_file_size .git/objects/pack/pack-*.pack |
| 23 | ' |
| 24 | |
| 25 | # simulate a fetch from a repository that last fetched N days ago, for |
| 26 | # various values of N. We do so by following the first-parent chain, |
| 27 | # and assume the first entry in the chain that is N days older than the current |
| 28 | # HEAD is where the HEAD would have been then. |
| 29 | for days in 1 2 4 8 16 32 64 128; do |
| 30 | title=$(printf '%10s' "($days days${argv:+, $argv})") |
| 31 | test_expect_success "setup revs from $days days ago" ' |
| 32 | now=$(git log -1 --format=%ct HEAD) && |
| 33 | then=$(($now - ($days * 86400))) && |
| 34 | tip=$(git rev-list -1 --first-parent --until=$then HEAD) && |
| 35 | { |
| 36 | echo HEAD && |
| 37 | echo ^$tip |
| 38 | } >revs |
| 39 | ' |
| 40 | |
| 41 | test_perf "server $title" ' |
| 42 | git pack-objects --stdout --revs \ |
| 43 | --thin --delta-base-offset \ |
| 44 | <revs >tmp.pack |
| 45 | ' |
| 46 | |
| 47 | test_size "size $title" ' |
| 48 | test_file_size tmp.pack |
| 49 | ' |
| 50 | |
| 51 | test_perf "client $title" ' |
| 52 | git index-pack --stdin --fix-thin <tmp.pack |
| 53 | ' |
| 54 | done |
| 55 | } |
| 56 | |
| 57 | for argv in '' --path-walk |
| 58 | do |
| 59 | test_fetch_bitmaps $argv || return 1 |
| 60 | done |
| 61 | |
| 62 | test_done |