t / perf / p5311-pack-bitmaps-fetch.shon commit Merge branch 'mm/p4-unshelve-windows-fix' into maint (0eb2774)
   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 repack -ad
  11'
  12
  13# simulate a fetch from a repository that last fetched N days ago, for
  14# various values of N. We do so by following the first-parent chain,
  15# and assume the first entry in the chain that is N days older than the current
  16# HEAD is where the HEAD would have been then.
  17for days in 1 2 4 8 16 32 64 128; do
  18        title=$(printf '%10s' "($days days)")
  19        test_expect_success "setup revs from $days days ago" '
  20                now=$(git log -1 --format=%ct HEAD) &&
  21                then=$(($now - ($days * 86400))) &&
  22                tip=$(git rev-list -1 --first-parent --until=$then HEAD) &&
  23                {
  24                        echo HEAD &&
  25                        echo ^$tip
  26                } >revs
  27        '
  28
  29        test_perf "server $title" '
  30                git pack-objects --stdout --revs \
  31                                 --thin --delta-base-offset \
  32                                 <revs >tmp.pack
  33        '
  34
  35        test_size "size   $title" '
  36                wc -c <tmp.pack
  37        '
  38
  39        test_perf "client $title" '
  40                git index-pack --stdin --fix-thin <tmp.pack
  41        '
  42done
  43
  44test_done