Skip to content

Commit d90d441

Browse files
avargitster
authored andcommitted
perf: add performance test for pickaxe
Add a test for the -G and -S pickaxe options and related options. This test supports being run with GIT_TEST_LONG=1 to adjust the limit on the number of commits from 1k to 10k. The 1k limit seems to hit a good spot on git.git Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 102fdd2 commit d90d441

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

t/perf/p4209-pickaxe.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/sh
2+
3+
test_description="Test pickaxe performance"
4+
5+
. ./perf-lib.sh
6+
7+
test_perf_default_repo
8+
9+
# Not --max-count, as that's the number of matching commit, so it's
10+
# unbounded. We want to limit our revision walk here.
11+
from_rev_desc=
12+
from_rev=
13+
max_count=1000
14+
if test_have_prereq EXPENSIVE
15+
then
16+
max_count=10000
17+
fi
18+
from_rev=" $(git rev-list HEAD | head -n $max_count | tail -n 1).."
19+
from_rev_desc=" <limit-rev>.."
20+
21+
for icase in \
22+
'' \
23+
'-i '
24+
do
25+
# -S (no regex)
26+
for pattern in \
27+
'int main' \
28+
'æ'
29+
do
30+
for opts in \
31+
'-S'
32+
do
33+
test_perf "git log $icase$opts'$pattern'$from_rev_desc" "
34+
git log --pretty=format:%H $icase$opts'$pattern'$from_rev
35+
"
36+
done
37+
done
38+
39+
# -S (regex)
40+
for pattern in \
41+
'(int|void|null)' \
42+
'if *\([^ ]+ & ' \
43+
'[àáâãäåæñøùúûüýþ]'
44+
do
45+
for opts in \
46+
'--pickaxe-regex -S'
47+
do
48+
test_perf "git log $icase$opts'$pattern'$from_rev_desc" "
49+
git log --pretty=format:%H $icase$opts'$pattern'$from_rev
50+
"
51+
done
52+
done
53+
54+
# -G
55+
for pattern in \
56+
'(int|void|null)' \
57+
'if *\([^ ]+ & ' \
58+
'[àáâãäåæñøùúûüýþ]'
59+
do
60+
for opts in \
61+
'-G'
62+
do
63+
test_perf "git log $icase$opts'$pattern'$from_rev_desc" "
64+
git log --pretty=format:%H $icase$opts'$pattern'$from_rev
65+
"
66+
done
67+
done
68+
done
69+
70+
test_done

0 commit comments

Comments
 (0)