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

Re: test-grep-lint is uncomfortably slow

From
Jeff King <peff@peff.net>
Date
Oct 14, 2026, 11:03 UTC
Message-ID
<20261014110330.GB1356555@coredump.intra.peff.net>
In-Reply-To
<xmqqjynueq81.fsf@gitster.g>
On Tue, Oct 06, 2026 at 09:41:34AM -0700, Junio C Hamano wrote:
> Does anyone else feel that make test takes too long to start?  There
> is a noticeable pause after "rm -f -r 'test-results'" before the first
> line of real output is shown.  The time in between is likely spent on
> make test-lint.

Yeah, "make test-greplint" takes ~6.5s to run for me. The whole test suite runs in ~111s, so that is over 5% of the time. ;) And of course it is more noticeable because there it is all at once before any output happens.

Chainlint actually takes similar amounts of CPU time (which is not surprising, because they share the parser) but it runs in parallel. We could probably do the same here.

It does feel like a lot of processing just to detect one specific type of lint error. If we amortized the parsing effort across other lint checks (or even chainlint itself!) that might be more palatable.

This patch does reduce the cost by ~50%:
diff --git a/t/greplint.pl b/t/greplint.pl
index 23efe27511..68b6eba78d 100644
--- a/t/greplint.pl
+++ b/t/greplint.pl
@@ -190,6 +190,15 @@ sub check_test {
 		}
 	}
 	return unless $body;
+	# We can never match a bare "grep" if there isn't one in the first
+	# place. So we can skip all of the parsing effort. Technically you
+	# can have:
+	#
+	#   gr\
+	#   ep
+	#
+	# but that is sufficiently insane that I think we can ignore it.
+	return unless $body =~ /grep/;
 
 	my $raw_lines = $self->{raw_lines};
 

but of course it is working against the "maybe we could amortize the
parsing cost" idea.

-Peff
Previous: Junio C HamanoNext: Tyler Cipriani
Message 2 of 7 in “test-grep-lint is uncomfortably slow”
  1. Junio C HamanoOct 6, 2026
  2. Jeff KingOct 14, 2026
  3. 0/4 t: run greplint checks inside chainlintTyler Cipriani, Oct 25, 2026
  4. 1/4 t/interop: replace bare grep with test_grepTyler Cipriani, Oct 25, 2026
  5. 2/4 t/greplint: skip test bodies without the word grepTyler Cipriani, Oct 25, 2026
  6. 3/4 t/greplint: move parsing and token check to libraryTyler Cipriani, Oct 25, 2026
  7. 4/4 t/chainlint: add --greplint to run greplintTyler Cipriani, Oct 25, 2026

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.