git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC PATCH 4/4] Add a performance test for git-grep

From
Thomas Rast <trast@student.ethz.ch>
Date
Dec 14, 2011, 15:23 UTC
Message-ID
<370de2c5c277513098480baf47f73ca6077787b0.1323876121.git.trast@student.ethz.ch>
In-Reply-To
<cover.1323876121.git.trast@student.ethz.ch>

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>
---
 t/perf/p7810-grep.sh |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100755 t/perf/p7810-grep.sh
diff --git a/t/perf/p7810-grep.sh b/t/perf/p7810-grep.sh
new file mode 100755
index 0000000..9f4ade6
--- /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
-- 
1.7.8.304.ge42e4
Previous: Thomas Rast
Message 9 of 9 in “Performance test framework”
  1. 0/4 Performance test frameworkThomas Rast, Dec 14, 2011
  2. 1/4 Move the user-facing test library to test-lib-functions.shThomas Rast, Dec 14, 2011
  3. 2/4 test-lib: allow testing another git build treeThomas Rast, Dec 14, 2011
  4. Junio C HamanoDec 15, 2011
  5. Thomas RastDec 15, 2011
  6. Junio C HamanoDec 15, 2011
  7. 3/4 Introduce a performance testing frameworkThomas Rast, Dec 14, 2011
  8. Thomas RastDec 14, 2011
  9. 4/4 Add a performance test for git-grepThomas Rast, Dec 14, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.