Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Micro-optimize type indirection visitor#19460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JukkaL merged 1 commit intomasterfromopt-2
Jul 18, 2025
Merged

Micro-optimize type indirection visitor#19460

JukkaL merged 1 commit intomasterfromopt-2
Jul 18, 2025

Conversation

@JukkaL
Copy link
Collaborator

@JukkaLJukkaL commentedJul 16, 2025
edited
Loading

Specialize iteration for the concrete typeslist andtuple, since this is faster than iterating over an abstract iterable in compiled code. Also avoid constructing many temporary lists.

Duplicate some very hot code in the hopes further improving performance slightly, through inlining and possibly also better branch prediction.

The approach is similar to what I used in#19459.

This is a part of a set of micro-optimizations that improve self check performance by ~5.5%.

Specialize iteration for the concrete types `list` and `tuple`,since this is faster than iterating over an abstract iterablein compiled code.Duplicate some very hot code in the hopes further improvingpreformance slightly, through inlining and possibly also betterbranch prediction.This is a part of a set of micro-optimizations that improve self checkperformance by ~5.5%.
@JukkaLJukkaL requested a review fromilevkivskyiJuly 16, 2025 12:57
@github-actions
Copy link
Contributor

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

Copy link
Member

@ilevkivskyiilevkivskyi left a comment

Choose a reason for hiding this comment

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

Interesting, I would never guess this is a hot code path.

@JukkaLJukkaL merged commit23e6072 intomasterJul 18, 2025
20 checks passed
@JukkaLJukkaL deleted the opt-2 branchJuly 18, 2025 08:28
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ilevkivskyiilevkivskyiilevkivskyi approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@JukkaL@ilevkivskyi

[8]ページ先頭

©2009-2025 Movatter.jp