Merge branch 'rs/blame-optim'
[alt-git.git] / t / perf / p5302-pack-index.sh
blob228593d9ad6b3a5c9a0b45eb5814a3a8746d42bc
1 #!/bin/sh
3 test_description="Tests index-pack performance"
5 . ./perf-lib.sh
7 test_perf_large_repo
9 test_expect_success 'repack' '
10 git repack -ad &&
11 PACK=$(ls .git/objects/pack/*.pack | head -n1) &&
12 test -f "$PACK" &&
13 export PACK
16 # Rather than counting up and doubling each time, count down from the endpoint,
17 # halving each time. That ensures that our final test uses as many threads as
18 # CPUs, even if it isn't a power of 2.
19 test_expect_success 'set up thread-counting tests' '
20 t=$(test-tool online-cpus) &&
21 threads= &&
22 while test $t -gt 0
24 threads="$t $threads"
25 t=$((t / 2))
26 done
29 test_perf PERF_EXTRA 'index-pack 0 threads' '
30 rm -rf repo.git &&
31 git init --bare repo.git &&
32 GIT_DIR=repo.git git index-pack --threads=1 --stdin < $PACK
35 for t in $threads
37 THREADS=$t
38 export THREADS
39 test_perf PERF_EXTRA "index-pack $t threads" '
40 rm -rf repo.git &&
41 git init --bare repo.git &&
42 GIT_DIR=repo.git GIT_FORCE_THREADS=1 \
43 git index-pack --threads=$THREADS --stdin <$PACK
45 done
47 test_perf 'index-pack default number of threads' '
48 rm -rf repo.git &&
49 git init --bare repo.git &&
50 GIT_DIR=repo.git git index-pack --stdin < $PACK
53 test_done