mirror of
https://github.com/git/git
synced 2024-11-05 18:59:29 +00:00
723fc5a6e1
Add a performance comparison test of log --grepgrep regex engines given fixed strings. See the preceding fixed-string t/perf change ("perf: add a comparison test of grep regex engines with -F", 2017-04-21) for notes about this, in particular this mostly tests exactly the same codepath now, but might not in the future: $ GIT_PERF_REPEAT_COUNT=10 GIT_PERF_LARGE_REPO=~/g/linux ./run p4221-log-grep-engines-fixed.sh [...] Test this tree -------------------------------------------------------- 4221.1: fixed log --grep='int' 5.99(5.55+0.40) 4221.2: basic log --grep='int' 5.92(5.56+0.31) 4221.3: extended log --grep='int' 6.01(5.51+0.45) 4221.4: perl log --grep='int' 5.99(5.56+0.38) 4221.6: fixed log --grep='uncommon' 5.06(4.76+0.27) 4221.7: basic log --grep='uncommon' 5.02(4.78+0.21) 4221.8: extended log --grep='uncommon' 4.99(4.78+0.20) 4221.9: perl log --grep='uncommon' 5.00(4.72+0.26) 4221.11: fixed log --grep='æ' 5.35(5.12+0.20) 4221.12: basic log --grep='æ' 5.34(5.11+0.20) 4221.13: extended log --grep='æ' 5.39(5.10+0.22) 4221.14: perl log --grep='æ' 5.44(5.16+0.23) Only the non-ASCII -i case is different: $ GIT_PERF_REPEAT_COUNT=10 GIT_PERF_LARGE_REPO=~/g/linux GIT_PERF_4221_LOG_OPTS=' -i' ./run p4221-log-grep-engines-fixed.sh [...] Test this tree ----------------------------------------------------------- 4221.1: fixed log -i --grep='int' 6.17(5.77+0.35) 4221.2: basic log -i --grep='int' 6.16(5.59+0.39) 4221.3: extended log -i --grep='int' 6.15(5.70+0.39) 4221.4: perl log -i --grep='int' 6.15(5.69+0.38) 4221.6: fixed log -i --grep='uncommon' 5.10(4.88+0.21) 4221.7: basic log -i --grep='uncommon' 5.04(4.76+0.25) 4221.8: extended log -i --grep='uncommon' 5.07(4.82+0.23) 4221.9: perl log -i --grep='uncommon' 5.03(4.78+0.22) 4221.11: fixed log -i --grep='æ' 5.93(5.65+0.25) 4221.12: basic log -i --grep='æ' 5.88(5.62+0.25) 4221.13: extended log -i --grep='æ' 6.02(5.69+0.29) 4221.14: perl log -i --grep='æ' 5.36(5.06+0.29) See commit ("perf: add a comparison test of grep regex engines", 2017-04-19) for details on the machine the above test run was executed on. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
44 lines
1,012 B
Bash
Executable file
44 lines
1,012 B
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description="Comparison of git-log's --grep regex engines with -F
|
|
|
|
Set GIT_PERF_4221_LOG_OPTS in the environment to pass options to
|
|
git-grep. Make sure to include a leading space,
|
|
e.g. GIT_PERF_4221_LOG_OPTS=' -i'. Some options to try:
|
|
|
|
-i
|
|
--invert-grep
|
|
-i --invert-grep
|
|
"
|
|
|
|
. ./perf-lib.sh
|
|
|
|
test_perf_large_repo
|
|
test_checkout_worktree
|
|
|
|
for pattern in 'int' 'uncommon' 'æ'
|
|
do
|
|
for engine in fixed basic extended perl
|
|
do
|
|
if test $engine = "perl" && ! test_have_prereq PCRE
|
|
then
|
|
prereq="PCRE"
|
|
else
|
|
prereq=""
|
|
fi
|
|
test_perf $prereq "$engine log$GIT_PERF_4221_LOG_OPTS --grep='$pattern'" "
|
|
git -c grep.patternType=$engine log --pretty=format:%h$GIT_PERF_4221_LOG_OPTS --grep='$pattern' >'out.$engine' || :
|
|
"
|
|
done
|
|
|
|
test_expect_success "assert that all engines found the same for$GIT_PERF_4221_LOG_OPTS '$pattern'" '
|
|
test_cmp out.fixed out.basic &&
|
|
test_cmp out.fixed out.extended &&
|
|
if test_have_prereq PCRE
|
|
then
|
|
test_cmp out.fixed out.perl
|
|
fi
|
|
'
|
|
done
|
|
|
|
test_done
|