t / perf / p5311-pack-bitmaps-fetch.shon commit Merge branch 'en/merge-options-doc' (082c15a)
   1#!/bin/sh
   2
   3test_description='performance of fetches from bitmapped packs'
   4. ./perf-lib.sh
   5
   6test_perf_default_repo
   7
   8test_expect_success 'create bitmapped server repo' '
   9        git config pack.writebitmaps true &&
  10        git config pack.writebitmaphashcache true &&
  11        git repack -ad
  12'
  13
  14# simulate a fetch from a repository that last fetched N days ago, for
  15# various values of N. We do so by following the first-parent chain,
  16# and assume the first entry in the chain that is N days older than the current
  17# HEAD is where the HEAD would have been then.
  18for days in 1 2 4 8 16 32 64 128; do
  19        title=$(printf '%10s' "($days days)")
  20        test_expect_success "setup revs from $days days ago" '
  21                now=$(git log -1 --format=%ct HEAD) &&
  22                then=$(($now - ($days * 86400))) &&
  23                tip=$(git rev-list -1 --first-parent --until=$then HEAD) &&
  24                {
  25                        echo HEAD &&
  26                        echo ^$tip
  27                } >revs
  28        '
  29
  30        test_perf "server $title" '
  31                git pack-objects --stdout --revs \
  32                                 --thin --delta-base-offset \
  33                                 <revs >tmp.pack
  34        '
  35
  36        test_size "size   $title" '
  37                wc -c <tmp.pack
  38        '
  39
  40        test_perf "client $title" '
  41                git index-pack --stdin --fix-thin <tmp.pack
  42        '
  43done
  44
  45test_done