Skip to content

Commit a4478c9

Browse files
committed
Merge branch 'jh/memihash-opt' into maint
perf-test update. * jh/memihash-opt: p0004: don't error out if test repo is too small p0004: don't abort if multi-threaded is too slow p0004: use test_perf p0004: avoid using pipes p0004: simplify calls of test-lazy-init-name-hash
2 parents 9e60e21 + c5a9157 commit a4478c9

File tree

1 file changed

+42
-5
lines changed

1 file changed

+42
-5
lines changed

t/perf/p0004-lazy-init-name-hash.sh

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,50 @@ test_perf_large_repo
77
test_checkout_worktree
88

99
test_expect_success 'verify both methods build the same hashmaps' '
10-
$GIT_BUILD_DIR/t/helper/test-lazy-init-name-hash$X --dump --single | sort >out.single &&
11-
$GIT_BUILD_DIR/t/helper/test-lazy-init-name-hash$X --dump --multi | sort >out.multi &&
12-
test_cmp out.single out.multi
10+
test-lazy-init-name-hash --dump --single >out.single &&
11+
if test-lazy-init-name-hash --dump --multi >out.multi
12+
then
13+
test_set_prereq REPO_BIG_ENOUGH_FOR_MULTI &&
14+
sort <out.single >sorted.single &&
15+
sort <out.multi >sorted.multi &&
16+
test_cmp sorted.single sorted.multi
17+
fi
1318
'
1419

15-
test_expect_success 'multithreaded should be faster' '
16-
$GIT_BUILD_DIR/t/helper/test-lazy-init-name-hash$X --perf >out.perf
20+
test_expect_success 'calibrate' '
21+
entries=$(wc -l <out.single) &&
22+
23+
case $entries in
24+
?) count=1000000 ;;
25+
??) count=100000 ;;
26+
???) count=10000 ;;
27+
????) count=1000 ;;
28+
?????) count=100 ;;
29+
??????) count=10 ;;
30+
*) count=1 ;;
31+
esac &&
32+
export count &&
33+
34+
case $entries in
35+
1) entries_desc="1 entry" ;;
36+
*) entries_desc="$entries entries" ;;
37+
esac &&
38+
39+
case $count in
40+
1) count_desc="1 round" ;;
41+
*) count_desc="$count rounds" ;;
42+
esac &&
43+
44+
desc="$entries_desc, $count_desc" &&
45+
export desc
1746
'
1847

48+
test_perf "single-threaded, $desc" "
49+
test-lazy-init-name-hash --single --count=$count
50+
"
51+
52+
test_perf REPO_BIG_ENOUGH_FOR_MULTI "multi-threaded, $desc" "
53+
test-lazy-init-name-hash --multi --count=$count
54+
"
55+
1956
test_done

0 commit comments

Comments
 (0)