Skip to content

Commit 134593c

Browse files
trastgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 342e9ef commit 134593c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

t/perf/p7810-grep.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
test_description="git-grep performance in various modes"
4+
5+
. ./perf-lib.sh
6+
7+
test_perf_large_repo
8+
test_checkout_worktree
9+
10+
test_perf 'grep worktree, cheap regex' '
11+
git grep some_nonexistent_string || :
12+
'
13+
test_perf 'grep worktree, expensive regex' '
14+
git grep "^.* *some_nonexistent_string$" || :
15+
'
16+
test_perf 'grep --cached, cheap regex' '
17+
git grep --cached some_nonexistent_string || :
18+
'
19+
test_perf 'grep --cached, expensive regex' '
20+
git grep --cached "^.* *some_nonexistent_string$" || :
21+
'
22+
23+
test_done

0 commit comments

Comments
 (0)