Merge branch 'fc/completion-updates' into maint
[git/debian.git] / t / perf / p0004-lazy-init-name-hash.sh
blob1afc08fe7f1990cdf7143f0dfd3cfaa66628ca73
1 #!/bin/sh
3 test_description='Tests multi-threaded lazy_init_name_hash'
4 . ./perf-lib.sh
6 test_perf_large_repo
7 test_checkout_worktree
9 test_expect_success 'verify both methods build the same hashmaps' '
10 test-tool lazy-init-name-hash --dump --single >out.single &&
11 if test-tool 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
20 test_expect_success 'calibrate' '
21 entries=$(wc -l <out.single) &&
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 &&
34 case $entries in
35 1) entries_desc="1 entry" ;;
36 *) entries_desc="$entries entries" ;;
37 esac &&
39 case $count in
40 1) count_desc="1 round" ;;
41 *) count_desc="$count rounds" ;;
42 esac &&
44 desc="$entries_desc, $count_desc" &&
45 export desc
48 test_perf "single-threaded, $desc" "
49 test-tool lazy-init-name-hash --single --count=$count
52 test_perf REPO_BIG_ENOUGH_FOR_MULTI "multi-threaded, $desc" "
53 test-tool lazy-init-name-hash --multi --count=$count
56 test_done