p5302: create the repo in each index-pack test

The p5302 script runs "index-pack --stdin" in each timing test. It does two things to try to get good timings: 1. we do the repo creation in a separate (non-timed) setup test, so that our timing is purely the index-pack run 2. we use a separate repo for each test; this is important because the presence of existing objects in the repo influences the result (because we'll end up doing collision checks against them) But this forgets one thing: we generally run each timed test multiple times to reduce the impact of noise. Which means that repeats of each test after the first will be subject to the collision slowdown from point 2, and we'll generally just end up taking the first time anyway. Instead, let's create the repo in the test (effectively undoing point 1). That does add a constant amount of extra work to each iteration, but it's quite small compared to the actual effects we're interested in measuring. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Apr 22, 2019 at 17:19 UTC 775c71e16d063fc4b72fd629a97b8ef4eb8d63d3
1 file changed +18 -13
t/perf/p5302-pack-index.sh
+18 -13
@@ -13,35 +13,40 @@ test_expect_success 'repack' '
13 export PACK
14 '
15
16 -test_expect_success 'create target repositories' '
17 - for repo in t1 t2 t3 t4 t5 t6
18 - do
19 - git init --bare $repo
20 - done
21 -'
22 -
16 test_perf 'index-pack 0 threads' '
24 - GIT_DIR=t1 git index-pack --threads=1 --stdin < $PACK
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
22 test_perf 'index-pack 1 thread ' '
28 - GIT_DIR=t2 GIT_FORCE_THREADS=1 git index-pack --threads=1 --stdin < $PACK
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
28 test_perf 'index-pack 2 threads' '
32 - GIT_DIR=t3 git index-pack --threads=2 --stdin < $PACK
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
34 test_perf 'index-pack 4 threads' '
36 - GIT_DIR=t4 git index-pack --threads=4 --stdin < $PACK
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
40 test_perf 'index-pack 8 threads' '
40 - GIT_DIR=t5 git index-pack --threads=8 --stdin < $PACK
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
46 test_perf 'index-pack default number of threads' '
44 - GIT_DIR=t6 git index-pack --stdin < $PACK
47 + rm -rf repo.git &&
48 + git init --bare repo.git &&
49 + GIT_DIR=repo.git git index-pack --stdin < $PACK
50 '
51
52 test_done