All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Joe Perches <joe@perches.com>, Andy Whitcroft <apw@canonical.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH 00/10] Make checkpatch faster
Date: Tue,  1 Dec 2026 14:53:44 -0800	[thread overview]
Message-ID: <cover.1796165270.git.bvanassche@acm.org> (raw)

Hi ,

LLMs tend to run checkpatch often. This patch series makes checkpatch about
twice as fast and prevents that it slows down LLM-based workflows
significantly. All then patches have been generated by an LLM.

Patches 1-3 avoid or cache the subprocesses. Patches 4-10 reduce
regex recompilation, add cheap pre-checks in front of expensive
regexes, use a hash for single-word spelling checks, and scan strings
in place instead of slicing them.

Timings with this series (Perl 5.40, one CPU, --strict):

  50 recent commits, tree mode:     11.1 s -> 2.4 s
  checkpatch -f kernel/sched/core.c:  8.1 s -> 4.1 s
  checkpatch -f fs/btrfs/inode.c:     8.7 s -> 4.2 s
  checkpatch -f ufs/core/ufshcd.c:    8.7 s -> 4.3 s

The goal is identical output. To check this, I ran the old and new
checkpatch.pl on the same inputs and compared stdout, stderr, the exit
code and the --fix results.

No differences were found apart from line numbers in existing Perl
warnings. Two intentional differences are described in patch 3: with
-f, a git-tracked file name containing a regex metacharacter no longer
makes checkpatch die, and some Perl warnings are printed once instead
of once per call.

Please consider this patch series for the next merge window.

Thanks,

Bart.

Bart Van Assche (10):
  checkpatch: pre-filter obsolete MAINTAINERS checks and gate on
    OBSOLETE
  checkpatch: cache SPDX license checks and gate on SPDX_LICENSE_TAG
  checkpatch: cache git and PATH lookups and skip git_is_single_file()
  checkpatch: skip redundant build_types() rebuilds
  checkpatch: avoid dynamic regex recompilation in hot checks
  checkpatch: guard expensive per-line regexes with cheap pre-checks
  checkpatch: use hash lookups for single-word spelling checks
  checkpatch: scan ctx_statement_block() in place without slicing
  checkpatch: scan annotate_values() in place with leading-char dispatch
  checkpatch: add fast paths to per-line character-scanning helpers

 scripts/checkpatch.pl | 728 +++++++++++++++++++++++++++++++-----------
 1 file changed, 539 insertions(+), 189 deletions(-)


             reply	other threads:[~2026-12-01 22:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 22:53 Bart Van Assche [this message]
2026-12-01 22:53 ` [PATCH 01/10] checkpatch: pre-filter obsolete MAINTAINERS checks and gate on OBSOLETE Bart Van Assche
2026-12-01 22:53 ` [PATCH 02/10] checkpatch: cache SPDX license checks and gate on SPDX_LICENSE_TAG Bart Van Assche
2026-12-01 22:53 ` [PATCH 03/10] checkpatch: cache git and PATH lookups and skip git_is_single_file() Bart Van Assche
2026-12-01 22:53 ` [PATCH 04/10] checkpatch: skip redundant build_types() rebuilds Bart Van Assche
2026-12-01 22:53 ` [PATCH 05/10] checkpatch: avoid dynamic regex recompilation in hot checks Bart Van Assche
2026-12-01 22:53 ` [PATCH 06/10] checkpatch: guard expensive per-line regexes with cheap pre-checks Bart Van Assche
2026-12-01 22:53 ` [PATCH 07/10] checkpatch: use hash lookups for single-word spelling checks Bart Van Assche
2026-12-01 22:53 ` [PATCH 08/10] checkpatch: scan ctx_statement_block() in place without slicing Bart Van Assche
2026-12-01 22:53 ` [PATCH 09/10] checkpatch: scan annotate_values() in place with leading-char dispatch Bart Van Assche
2026-12-01 22:53 ` [PATCH 10/10] checkpatch: add fast paths to per-line character-scanning helpers Bart Van Assche
2026-12-01 23:26 ` [PATCH 00/10] Make checkpatch faster Joe Perches
2026-12-01 23:53   ` Bart Van Assche

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=cover.1796165270.git.bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.