From: Taylor Blau <ttaylorr@openai.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: tnyman@openai.com, git@vger.kernel.org, haraldnordgren@gmail.com
Subject: Re: [PATCH] branch: avoid slow strvec Coccinelle matching
Date: Fri, 24 Jul 2026 16:20:41 -0500 [thread overview]
Message-ID: <amPXKfnoTzUuuyMN@com-79390> (raw)
In-Reply-To: <xmqq33x89zn9.fsf@gitster.g>
On Fri, Jul 24, 2026 at 08:27:06AM -0700, Junio C Hamano wrote:
> tnyman@openai.com writes:
>
> > From: Ted Nyman <tnyman@openai.com>
> >
> > The --delete-merged implementation declares a loop index at function
> > scope and reuses it to walk its strvec of upstreams and its list of
> > candidate branches. Coccinelle 1.1.1 spends hours matching this against
> > the separate_loop_index rule in tools/coccinelle/strvec.cocci, causing
> > the static-analysis job on 'seen' to reach its six-hour timeout.
> > ...
> > The CI failure reproduces locally with Coccinelle 1.1.1: applying
> > strvec.cocci to the original builtin/branch.c still times out with
> > "spatch --timeout 120". With this change, the same check completes in
> > 0.06 seconds.
>
> Impressive. Nicely analyzed.
>
> Even though this is very much like bending the code only to appease
> the checker, the resulting code is arguably better in this
> particular case, so I do not feel as bad as I have on other
> occasions when we had to work around deficiencies in our tools [*].
Agreed. I don't think we should ever bend over backwards to appease a
static analysis tool, *especially* when it results in worse looking
code. But this case is a strict improvement, and just so happens to
address the Coccinelle issue. ;-)
> I see Harald already took this in the latest update. Thanks for
> working well together.
Yup. Thanks, both.
Thanks,
Taylor
prev parent reply other threads:[~2026-07-24 21:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 9:11 [PATCH] branch: avoid slow strvec Coccinelle matching tnyman
2026-07-24 11:49 ` Jeff King
2026-07-24 12:35 ` Harald Nordgren
2026-07-24 15:58 ` Junio C Hamano
2026-07-24 16:26 ` Junio C Hamano
2026-07-24 17:33 ` Junio C Hamano
2026-07-24 15:27 ` Junio C Hamano
2026-07-24 21:20 ` Taylor Blau [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=amPXKfnoTzUuuyMN@com-79390 \
--to=ttaylorr@openai.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=haraldnordgren@gmail.com \
--cc=tnyman@openai.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox