Jeff King | bbcefa1 | 2013-12-21 09:00:42 -0500 | [diff] [blame] | 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 |
Jeff King | 71d76cb | 2014-06-10 16:20:30 -0400 | [diff] [blame] | 11 | # |
| 12 | # We intentionally use the deprecated pack.writebitmaps |
| 13 | # config so that we can test against older versions of git. |
Jeff King | bbcefa1 | 2013-12-21 09:00:42 -0500 | [diff] [blame] | 14 | test_expect_success 'setup bitmap config' ' |
Vicent Marti | ae4f07f | 2013-12-21 09:00:45 -0500 | [diff] [blame] | 15 | git config pack.writebitmaps true && |
| 16 | git config pack.writebitmaphashcache true |
Jeff King | bbcefa1 | 2013-12-21 09:00:42 -0500 | [diff] [blame] | 17 | ' |
| 18 | |
| 19 | test_perf 'repack to disk' ' |
| 20 | git repack -ad |
| 21 | ' |
| 22 | |
| 23 | test_perf 'simulated clone' ' |
| 24 | git pack-objects --stdout --all </dev/null >/dev/null |
| 25 | ' |
| 26 | |
| 27 | test_perf 'simulated fetch' ' |
| 28 | have=$(git rev-list HEAD~100 -1) && |
| 29 | { |
| 30 | echo HEAD && |
| 31 | echo ^$have |
| 32 | } | git pack-objects --revs --stdout >/dev/null |
| 33 | ' |
| 34 | |
Kirill Smelkov | 645c432 | 2016-09-10 18:01:44 +0300 | [diff] [blame] | 35 | test_perf 'pack to file' ' |
| 36 | git pack-objects --all pack1 </dev/null >/dev/null |
| 37 | ' |
| 38 | |
| 39 | test_perf 'pack to file (bitmap)' ' |
| 40 | git pack-objects --use-bitmap-index --all pack1b </dev/null >/dev/null |
| 41 | ' |
| 42 | |
Jeff King | bbcefa1 | 2013-12-21 09:00:42 -0500 | [diff] [blame] | 43 | test_expect_success 'create partial bitmap state' ' |
| 44 | # pick a commit to represent the repo tip in the past |
| 45 | cutoff=$(git rev-list HEAD~100 -1) && |
| 46 | orig_tip=$(git rev-parse HEAD) && |
| 47 | |
| 48 | # now kill off all of the refs and pretend we had |
| 49 | # just the one tip |
Stefan Beller | 5330e6e | 2015-06-26 14:27:00 -0700 | [diff] [blame] | 50 | rm -rf .git/logs .git/refs/* .git/packed-refs && |
| 51 | git update-ref HEAD $cutoff && |
Jeff King | bbcefa1 | 2013-12-21 09:00:42 -0500 | [diff] [blame] | 52 | |
| 53 | # and then repack, which will leave us with a nice |
| 54 | # big bitmap pack of the "old" history, and all of |
| 55 | # the new history will be loose, as if it had been pushed |
| 56 | # up incrementally and exploded via unpack-objects |
Stefan Beller | 5330e6e | 2015-06-26 14:27:00 -0700 | [diff] [blame] | 57 | git repack -Ad && |
Jeff King | bbcefa1 | 2013-12-21 09:00:42 -0500 | [diff] [blame] | 58 | |
| 59 | # and now restore our original tip, as if the pushes |
| 60 | # had happened |
| 61 | git update-ref HEAD $orig_tip |
| 62 | ' |
| 63 | |
Kirill Smelkov | 645c432 | 2016-09-10 18:01:44 +0300 | [diff] [blame] | 64 | test_perf 'clone (partial bitmap)' ' |
Jeff King | bbcefa1 | 2013-12-21 09:00:42 -0500 | [diff] [blame] | 65 | git pack-objects --stdout --all </dev/null >/dev/null |
| 66 | ' |
| 67 | |
Kirill Smelkov | 645c432 | 2016-09-10 18:01:44 +0300 | [diff] [blame] | 68 | test_perf 'pack to file (partial bitmap)' ' |
| 69 | git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null |
| 70 | ' |
| 71 | |
Jeff King | bbcefa1 | 2013-12-21 09:00:42 -0500 | [diff] [blame] | 72 | test_done |