Skip to content

speed up linting - #5121

Merged
bakkot merged 2 commits into
mainfrom
faster-lint
Sep 2, 2026
Merged

speed up linting#5121
bakkot merged 2 commits into
mainfrom
faster-lint

Conversation

@bakkot

@bakkot bakkot commented Aug 30, 2026

Copy link
Copy Markdown
Member

This was generated by Claude in response to

figure out why linting is slow and make it faster (with minimal changes - this still needs to be maintained by the same set of people, so don't completely rewrite everything).

On my machine this takes it from ~90 seconds to ~5 seconds. Half of that is from caching the checks instead of reconstructing them per file; the remainder is from using pyyaml's c parser instead of the python one. Also bumps the version of pyyaml so that it is more likely to have the c parser included in CI; the only breaking change is dropping support for Python 2.7, which seems fine.

I am reasonably sure the change to get the events by running the parser twice is semantics-preserving, and it's actually faster on my machine than the current subclassing approach even when using pyyaml's python-based parser.

@bakkot
bakkot requested a review from a team as a code owner August 30, 2026 16:11

@gibson042 gibson042 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and (referring to the prompt) I'm happy to continue maintaining the result.

@ptomato ptomato left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for looking into this.

@bakkot
bakkot enabled auto-merge (squash) September 2, 2026 18:41
@bakkot
bakkot merged commit 2808d41 into main Sep 2, 2026
11 checks passed
@bakkot
bakkot deleted the faster-lint branch September 2, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants