git
[Ported from github.com/git/git] Sync with Git 2.56.1
Brought by drakestapleton
git / t / perf / p5413-connectivity-check.sh
| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='performance of connectivity check modes |
| 4 | |
| 5 | Compare the default and incremental rev-list connectivity modes |
| 6 | directly, avoiding pack transfer noise. |
| 7 | |
| 8 | Each repository has a flat tree of many directories with 100 files |
| 9 | in each. Three axes are scaled independently: tree size, commit |
| 10 | count, and files changed per commit.' |
| 11 | |
| 12 | . ./perf-lib.sh |
| 13 | |
| 14 | test_perf_fresh_repo |
| 15 | |
| 16 | generate="$TEST_DIRECTORY/perf/generate-repo-p5413-connectivity-check.perl" |
| 17 | |
| 18 | # $1=dirs $2=files_per_dir $3=commits $4=hot_dirs (optional, default=all) |
| 19 | # $5=files_per_commit (optional, default=1) |
| 20 | test_perf_conn () { |
| 21 | local nd="$1" nf="$2" nc="$3" hot="${4:-$1}" fpc="${5:-1}" |
| 22 | local total=$(($nd * $nf)) |
| 23 | local name="repo-${nd}d-${nf}f-${nc}c-${hot}h-${fpc}fpc" |
| 24 | local label="${total} files, ${nc} commits" |
| 25 | if test "$hot" -lt "$nd" |
| 26 | then |
| 27 | label="$label (${hot} hot dirs)" |
| 28 | fi |
| 29 | if test "$fpc" -gt 1 |
| 30 | then |
| 31 | label="$label (${fpc} files/commit)" |
| 32 | fi |
| 33 | |
| 34 | test_expect_success PERL "setup $label" ' |
| 35 | if test -d '"$name"' |
| 36 | then |
| 37 | true |
| 38 | else |
| 39 | git init '"$name"' && |
| 40 | "$PERL_PATH" '"$generate"' '"$nd"' '"$nf"' '"$nc"' '"$hot"' '"$fpc"' | |
| 41 | git -C '"$name"' fast-import --date-format=now --quiet && |
| 42 | ( |
| 43 | cd '"$name"' && |
| 44 | git rev-parse main~'"$nc"' >../'"${name}"'_old && |
| 45 | git rev-parse main >../'"${name}"'_new && |
| 46 | git update-ref refs/heads/main \ |
| 47 | $(cat ../'"${name}"'_old) && |
| 48 | git repack -ad && |
| 49 | git config gc.auto 0 |
| 50 | ) |
| 51 | fi |
| 52 | ' |
| 53 | |
| 54 | test_perf "$label (full)" --prereq PERL ' |
| 55 | cat '"${name}"'_new | |
| 56 | git -C '"$name"' rev-list --connectivity-check=full \ |
| 57 | --objects --stdin --not --all --quiet \ |
| 58 | --exclude-promisor-objects |
| 59 | ' |
| 60 | |
| 61 | test_perf "$label (incremental)" --prereq PERL ' |
| 62 | cat '"${name}"'_new | |
| 63 | git -C '"$name"' rev-list --connectivity-check=incremental \ |
| 64 | --objects --stdin --not --all --quiet \ |
| 65 | --exclude-promisor-objects |
| 66 | ' |
| 67 | } |
| 68 | |
| 69 | # Scaling tree size (10 commits, 10 files/commit). |
| 70 | test_perf_conn 50 100 10 50 10 |
| 71 | test_perf_conn 500 100 10 500 10 |
| 72 | test_perf_conn 2000 100 10 2000 10 |
| 73 | test_perf_conn 8000 100 10 8000 10 |
| 74 | |
| 75 | # Scaling commit count (200K files, 10 files/commit). |
| 76 | test_perf_conn 2000 100 1 2000 10 |
| 77 | test_perf_conn 2000 100 10 2000 10 |
| 78 | test_perf_conn 2000 100 100 2000 10 |
| 79 | test_perf_conn 2000 100 500 2000 10 |
| 80 | test_perf_conn 2000 100 3000 2000 10 |
| 81 | test_perf_conn 2000 100 5000 2000 10 |
| 82 | test_perf_conn 2000 100 10000 2000 10 |
| 83 | |
| 84 | # Scaling files per commit (200K files, 10 commits). |
| 85 | test_perf_conn 2000 100 10 2000 1 |
| 86 | test_perf_conn 2000 100 10 2000 10 |
| 87 | test_perf_conn 2000 100 10 2000 100 |
| 88 | test_perf_conn 2000 100 10 2000 500 |
| 89 | test_perf_conn 2000 100 10 2000 1000 |
| 90 | test_perf_conn 2000 100 10 2000 2000 |
| 91 | |
| 92 | test_done |