1#!/bin/sh
2
3test_description="Tests index-pack performance"
4
5. ./perf-lib.sh
6
7test_perf_large_repo
8
9test_expect_success 'repack' '
10 git repack -ad &&
11 PACK=$(ls .git/objects/pack/*.pack | head -n1) &&
12 test -f "$PACK" &&
13 export PACK
14'
15
16test_perf 'index-pack 0 threads' '
17 rm -rf repo.git &&
18 git init --bare repo.git &&
19 GIT_DIR=repo.git git index-pack --threads=1 --stdin < $PACK
20'
21
22test_perf 'index-pack 1 thread ' '
23 rm -rf repo.git &&
24 git init --bare repo.git &&
25 GIT_DIR=repo.git GIT_FORCE_THREADS=1 git index-pack --threads=1 --stdin < $PACK
26'
27
28test_perf 'index-pack 2 threads' '
29 rm -rf repo.git &&
30 git init --bare repo.git &&
31 GIT_DIR=repo.git git index-pack --threads=2 --stdin < $PACK
32'
33
34test_perf 'index-pack 4 threads' '
35 rm -rf repo.git &&
36 git init --bare repo.git &&
37 GIT_DIR=repo.git git index-pack --threads=4 --stdin < $PACK
38'
39
40test_perf 'index-pack 8 threads' '
41 rm -rf repo.git &&
42 git init --bare repo.git &&
43 GIT_DIR=repo.git git index-pack --threads=8 --stdin < $PACK
44'
45
46test_perf 'index-pack default number of threads' '
47 rm -rf repo.git &&
48 git init --bare repo.git &&
49 GIT_DIR=repo.git git index-pack --stdin < $PACK
50'
51
52test_done