summaryrefslogtreecommitdiff
path: root/t/perf
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-07-13 23:52:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-07-13 23:52:50 (GMT)
commit4da281e84d87b099ba8d0a255534dc1251be968e (patch)
tree5919bdb367772fbbbe822f72f33ea2256b94d33a /t/perf
parentc9780bb2ca81828ec4f43c60b2107c335271a72f (diff)
parent5d93460024541909337d6b08a8bec10b71caaf73 (diff)
downloadgit-4da281e84d87b099ba8d0a255534dc1251be968e.zip
git-4da281e84d87b099ba8d0a255534dc1251be968e.tar.gz
git-4da281e84d87b099ba8d0a255534dc1251be968e.tar.bz2
Merge branch 'ab/pickaxe-pcre2'
Rewrite the backend for "diff -G/-S" to use pcre2 engine when available. * ab/pickaxe-pcre2: (22 commits) xdiff-interface: replace discard_hunk_line() with a flag xdiff users: use designated initializers for out_line pickaxe -G: don't special-case create/delete pickaxe -G: terminate early on matching lines xdiff-interface: allow early return from xdiff_emit_line_fn xdiff-interface: prepare for allowing early return pickaxe -S: slightly optimize contains() pickaxe: rename variables in has_changes() for brevity pickaxe -S: support content with NULs under --pickaxe-regex pickaxe: assert that we must have a needle under -G or -S pickaxe: refactor function selection in diffcore-pickaxe() perf: add performance test for pickaxe pickaxe/style: consolidate declarations and assignments diff.h: move pickaxe fields together again pickaxe: die when --find-object and --pickaxe-all are combined pickaxe: die when -G and --pickaxe-regex are combined pickaxe tests: add missing test for --no-pickaxe-regex being an error pickaxe tests: test for -G, -S and --find-object incompatibility pickaxe tests: add test for "log -S" not being a regex pickaxe tests: add test for diffgrep_consume() internals ...
Diffstat (limited to 't/perf')
-rwxr-xr-xt/perf/p4209-pickaxe.sh70
1 files changed, 70 insertions, 0 deletions
diff --git a/t/perf/p4209-pickaxe.sh b/t/perf/p4209-pickaxe.sh
new file mode 100755
index 0000000..f585a44
--- /dev/null
+++ b/t/perf/p4209-pickaxe.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+test_description="Test pickaxe performance"
+
+. ./perf-lib.sh
+
+test_perf_default_repo
+
+# Not --max-count, as that's the number of matching commit, so it's
+# unbounded. We want to limit our revision walk here.
+from_rev_desc=
+from_rev=
+max_count=1000
+if test_have_prereq EXPENSIVE
+then
+ max_count=10000
+fi
+from_rev=" $(git rev-list HEAD | head -n $max_count | tail -n 1).."
+from_rev_desc=" <limit-rev>.."
+
+for icase in \
+ '' \
+ '-i '
+do
+ # -S (no regex)
+ for pattern in \
+ 'int main' \
+ 'æ'
+ do
+ for opts in \
+ '-S'
+ do
+ test_perf "git log $icase$opts'$pattern'$from_rev_desc" "
+ git log --pretty=format:%H $icase$opts'$pattern'$from_rev
+ "
+ done
+ done
+
+ # -S (regex)
+ for pattern in \
+ '(int|void|null)' \
+ 'if *\([^ ]+ & ' \
+ '[àáâãäåæñøùúûüýþ]'
+ do
+ for opts in \
+ '--pickaxe-regex -S'
+ do
+ test_perf "git log $icase$opts'$pattern'$from_rev_desc" "
+ git log --pretty=format:%H $icase$opts'$pattern'$from_rev
+ "
+ done
+ done
+
+ # -G
+ for pattern in \
+ '(int|void|null)' \
+ 'if *\([^ ]+ & ' \
+ '[àáâãäåæñøùúûüýþ]'
+ do
+ for opts in \
+ '-G'
+ do
+ test_perf "git log $icase$opts'$pattern'$from_rev_desc" "
+ git log --pretty=format:%H $icase$opts'$pattern'$from_rev
+ "
+ done
+ done
+done
+
+test_done