From: Jeff King Date: Wed, 14 Oct 2026 11:03:30 GMT Subject: Re: test-grep-lint is uncomfortably slow Message-ID: <20261014110330.GB1356555@coredump.intra.peff.net> In-Reply-To: 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