summaryrefslogtreecommitdiff
path: root/t/perf
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-01-05 22:01:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-01-05 22:01:29 (GMT)
commit2b755b337134aac9b1386e2d216cf734e1e229d2 (patch)
treea1ffb96dc36429bc60a9b4b4a53a96b0ed140f42 /t/perf
parentead6767ad7f835f4802248371709c4506ad6a4f1 (diff)
parent72962e8b3c3ea3a631166876b4668718103be4fe (diff)
downloadgit-2b755b337134aac9b1386e2d216cf734e1e229d2.zip
git-2b755b337134aac9b1386e2d216cf734e1e229d2.tar.gz
git-2b755b337134aac9b1386e2d216cf734e1e229d2.tar.bz2
Merge branch 'pw/diff-color-moved-fix'
Correctness and performance update to "diff --color-moved" feature. * pw/diff-color-moved-fix: diff --color-moved: intern strings diff: use designated initializers for emitted_diff_symbol diff --color-moved-ws=allow-indentation-change: improve hash lookups diff --color-moved: stop clearing potential moved blocks diff --color-moved: shrink potential moved blocks as we go diff --color-moved: unify moved block growth functions diff --color-moved: call comparison function directly diff --color-moved-ws=allow-indentation-change: simplify and optimize diff: simplify allow-indentation-change delta calculation diff --color-moved: avoid false short line matches and bad zebra coloring diff --color-moved=zebra: fix alternate coloring diff --color-moved: rewind when discarding pmb diff --color-moved: factor out function diff --color-moved: clear all flags on blocks that are too short diff --color-moved: add perf tests
Diffstat (limited to 't/perf')
-rwxr-xr-xt/perf/p4002-diff-color-moved.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/t/perf/p4002-diff-color-moved.sh b/t/perf/p4002-diff-color-moved.sh
new file mode 100755
index 0000000..ab2af93
--- /dev/null
+++ b/t/perf/p4002-diff-color-moved.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+test_description='Tests diff --color-moved performance'
+. ./perf-lib.sh
+
+test_perf_default_repo
+
+# The endpoints of the diff can be customized by setting TEST_REV_A
+# and TEST_REV_B in the environment when running this test.
+
+rev="${TEST_REV_A:-v2.28.0}"
+if ! rev_a="$(git rev-parse --quiet --verify "$rev")"
+then
+ skip_all="skipping because '$rev' was not found. \
+ Use TEST_REV_A and TEST_REV_B to set the revs to use"
+ test_done
+fi
+rev="${TEST_REV_B:-v2.29.0}"
+if ! rev_b="$(git rev-parse --quiet --verify "$rev")"
+then
+ skip_all="skipping because '$rev' was not found. \
+ Use TEST_REV_A and TEST_REV_B to set the revs to use"
+ test_done
+fi
+
+GIT_PAGER_IN_USE=1
+test_export GIT_PAGER_IN_USE rev_a rev_b
+
+test_perf 'diff --no-color-moved --no-color-moved-ws large change' '
+ git diff --no-color-moved --no-color-moved-ws $rev_a $rev_b
+'
+
+test_perf 'diff --color-moved --no-color-moved-ws large change' '
+ git diff --color-moved=zebra --no-color-moved-ws $rev_a $rev_b
+'
+
+test_perf 'diff --color-moved-ws=allow-indentation-change large change' '
+ git diff --color-moved=zebra --color-moved-ws=allow-indentation-change \
+ $rev_a $rev_b
+'
+
+test_perf 'log --no-color-moved --no-color-moved-ws' '
+ git log --no-color-moved --no-color-moved-ws --no-merges --patch \
+ -n1000 $rev_b
+'
+
+test_perf 'log --color-moved --no-color-moved-ws' '
+ git log --color-moved=zebra --no-color-moved-ws --no-merges --patch \
+ -n1000 $rev_b
+'
+
+test_perf 'log --color-moved-ws=allow-indentation-change' '
+ git log --color-moved=zebra --color-moved-ws=allow-indentation-change \
+ --no-merges --patch -n1000 $rev_b
+'
+
+test_done