about summary refs log tree commit diff
path: root/third_party/git/t/perf/p7810-grep.sh
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/git/t/perf/p7810-grep.sh')
-rwxr-xr-xthird_party/git/t/perf/p7810-grep.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/third_party/git/t/perf/p7810-grep.sh b/third_party/git/t/perf/p7810-grep.sh
new file mode 100755
index 000000000000..9f4ade639f74
--- /dev/null
+++ b/third_party/git/t/perf/p7810-grep.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+test_description="git-grep performance in various modes"
+
+. ./perf-lib.sh
+
+test_perf_large_repo
+test_checkout_worktree
+
+test_perf 'grep worktree, cheap regex' '
+	git grep some_nonexistent_string || :
+'
+test_perf 'grep worktree, expensive regex' '
+	git grep "^.* *some_nonexistent_string$" || :
+'
+test_perf 'grep --cached, cheap regex' '
+	git grep --cached some_nonexistent_string || :
+'
+test_perf 'grep --cached, expensive regex' '
+	git grep --cached "^.* *some_nonexistent_string$" || :
+'
+
+test_done