summaryrefslogtreecommitdiff
path: root/t/perf
diff options
context:
space:
mode:
authorLibravatar Thomas Rast <trast@student.ethz.ch>2012-02-17 11:25:10 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-02-17 08:21:34 -0800
commit134593c8ca1866bfbb0c63506f350ce9868fd7e5 (patch)
tree3c9c5d85437772b38cf7b75f8c56097f1a907672 /t/perf
parentIntroduce a performance testing framework (diff)
downloadtgif-134593c8ca1866bfbb0c63506f350ce9868fd7e5.tar.xz
Add a performance test for git-grep
The only catch is that we don't really know what our repo contains, so we have to ignore any possible "not found" status from git-grep. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/perf')
-rwxr-xr-xt/perf/p7810-grep.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/perf/p7810-grep.sh b/t/perf/p7810-grep.sh
new file mode 100755
index 0000000000..9f4ade639f
--- /dev/null
+++ b/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