Web lists-archives.com

[PATCH v2 17/29] perf: add a performance comparison of fixed-string grep




Add a performance comparison test which compares both case-sensitive &
case-insensitive fixed-string grep, as well as non-ASCII
case-sensitive & case-insensitive grep.

Currently only the "-i æ" performance test doesn't go through the same
kwset.[ch] codepath, see the "Even when -F..." comment in grep.c.

    $ GIT_PERF_REPEAT_COUNT=10 GIT_PERF_LARGE_REPO=~/g/linux ./run p7821-grep-engines-fixed.sh
    ----------------------------------------------
    7821.1: fixed grep int         1.75(1.39+0.34)
    7821.2: basic grep int         1.68(1.38+0.28)
    7821.3: extended grep int      1.75(1.41+0.29)
    7821.4: perl grep int          1.73(1.40+0.30)
    7821.6: fixed grep -i int      1.94(1.54+0.35)
    7821.7: basic grep -i int      1.92(1.57+0.32)
    7821.8: extended grep -i int   1.90(1.54+0.30)
    7821.9: perl grep -i int       1.91(1.53+0.36)
    7821.11: fixed grep æ          1.35(1.14+0.18)
    7821.12: basic grep æ          1.34(1.16+0.16)
    7821.13: extended grep æ       1.33(1.15+0.17)
    7821.14: perl grep æ           1.35(1.12+0.20)
    7821.16: fixed grep -i æ       0.72(0.49+0.22)
    7821.17: basic grep -i æ       0.74(0.49+0.21)
    7821.18: extended grep -i æ    0.72(0.48+0.22)
    7821.19: perl grep -i æ        0.71(0.44+0.23)

I'm planning to make that not be the case, this performance test gives
a baseline for comparing performance before & after any such change.

See commit ("perf: add a performance comparison test of grep -G, -E
and -P", 2017-04-19) for details on the machine the above test run was
executed on.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 t/perf/p7821-grep-engines-fixed.sh | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100755 t/perf/p7821-grep-engines-fixed.sh

diff --git a/t/perf/p7821-grep-engines-fixed.sh b/t/perf/p7821-grep-engines-fixed.sh
new file mode 100755
index 0000000000..d771cccfdf
--- /dev/null
+++ b/t/perf/p7821-grep-engines-fixed.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+test_description="Comparison of fixed string grep under git-grep's regex engines"
+
+. ./perf-lib.sh
+
+test_perf_large_repo
+test_checkout_worktree
+
+for args in 'int' '-i int' 'æ' '-i æ'
+do
+	for engine in fixed basic extended perl
+	do
+		test_perf "$engine grep $args" "
+			git -c grep.patternType=$engine grep $args >'out.$engine.$args' || :
+		"
+	done
+
+	test_expect_success "assert that all engines found the same for $args" "
+		test_cmp 'out.fixed.$args' 'out.basic.$args' &&
+		test_cmp 'out.fixed.$args' 'out.extended.$args' &&
+		test_cmp 'out.fixed.$args' 'out.perl.$args'
+	"
+done
+
+test_done
-- 
2.11.0