Skip to content

Commit 48a6ace

Browse files
rscharfegitster
authored andcommitted
p0004: use test_perf
The perf test suite (more specifically: t/perf/aggregate.perl) requires each test script to write test results into a file, otherwise it aborts when aggregating. Add actual performance tests with test_perf to allow p0004 to be run together with other perf scripts. Calibrate the value for the parameter --count based on the size of the test repository, in order to get meaningful results with smaller repos yet still be able to finish the script against huge ones without having to wait for hours. Signed-off-by: Rene Scharfe <[email protected]> Acked-by: Jeff Hostetler <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e1ebb56 commit 48a6ace

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,40 @@ test_expect_success 'multithreaded should be faster' '
1818
test-lazy-init-name-hash --perf >out.perf
1919
'
2020

21+
test_expect_success 'calibrate' '
22+
entries=$(wc -l <out.single) &&
23+
24+
case $entries in
25+
?) count=1000000 ;;
26+
??) count=100000 ;;
27+
???) count=10000 ;;
28+
????) count=1000 ;;
29+
?????) count=100 ;;
30+
??????) count=10 ;;
31+
*) count=1 ;;
32+
esac &&
33+
export count &&
34+
35+
case $entries in
36+
1) entries_desc="1 entry" ;;
37+
*) entries_desc="$entries entries" ;;
38+
esac &&
39+
40+
case $count in
41+
1) count_desc="1 round" ;;
42+
*) count_desc="$count rounds" ;;
43+
esac &&
44+
45+
desc="$entries_desc, $count_desc" &&
46+
export desc
47+
'
48+
49+
test_perf "single-threaded, $desc" "
50+
test-lazy-init-name-hash --single --count=$count
51+
"
52+
53+
test_perf "multi-threaded, $desc" "
54+
test-lazy-init-name-hash --multi --count=$count
55+
"
56+
2157
test_done

0 commit comments

Comments
 (0)