]>
Commit | Line | Data |
---|---|---|
89c3b0ad JH |
1 | #!/bin/sh |
2 | ||
3 | test_description='Tests multi-threaded lazy_init_name_hash' | |
4 | . ./perf-lib.sh | |
5 | ||
6 | test_perf_large_repo | |
7 | test_checkout_worktree | |
8 | ||
9 | test_expect_success 'verify both methods build the same hashmaps' ' | |
64eb82fe NTND |
10 | test-tool lazy-init-name-hash --dump --single >out.single && |
11 | if test-tool lazy-init-name-hash --dump --multi >out.multi | |
c5a91573 RS |
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 | |
89c3b0ad JH |
18 | ' |
19 | ||
48a6ace8 RS |
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 | |
46 | ' | |
47 | ||
48 | test_perf "single-threaded, $desc" " | |
64eb82fe | 49 | test-tool lazy-init-name-hash --single --count=$count |
48a6ace8 RS |
50 | " |
51 | ||
59c72303 | 52 | test_perf "multi-threaded, $desc" --prereq REPO_BIG_ENOUGH_FOR_MULTI " |
64eb82fe | 53 | test-tool lazy-init-name-hash --multi --count=$count |
48a6ace8 RS |
54 | " |
55 | ||
89c3b0ad | 56 | test_done |