Skip to content

Optimization: make State final and avoid construction via cls()#20838

Merged
JukkaL merged 1 commit intomasterfrom
optimize-state-init
Feb 17, 2026
Merged

Optimization: make State final and avoid construction via cls()#20838
JukkaL merged 1 commit intomasterfrom
optimize-state-init

Conversation

@JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Feb 17, 2026

Construction via cls() was pretty slow, possibly due to the large number of keyword arguments, as this used a generic calling convention because of mypyc limitations. This might improve performance of mostly cached, huge incremental builds by 1-2% perhaps, if the CPU profiles I looked at are to be trusted.

Constructions via cls() was pretty slow due to the large number of keyword
arguments, as this used a generic calling convention.
@JukkaL JukkaL requested a review from ilevkivskyi February 17, 2026 16:28
@github-actions
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@JukkaL JukkaL merged commit d52169d into master Feb 17, 2026
24 checks passed
@JukkaL JukkaL deleted the optimize-state-init branch February 17, 2026 17:31
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.

2 participants