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

GH-131798: Allow the JIT to remove moreint/float/str guards#131800

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

Conversation

brandtbucher
Copy link
Member

@brandtbucherbrandtbucher commentedMar 27, 2025
edited by bedevere-appbot
Loading

This changes the definitions ofBINARY_OP_SUBSCR_LIST_INT,BINARY_OP_SUBSCR_STR_INT,BINARY_OP_SUBSCR_TUPLE_INT, andSTORE_SUBSCR_LIST_INT to use our existingint/str guards for their operands (I'll add new guards for the containers themselves in a follow-up PR). This way, they can be removed when possible.

As part of this change, get rid of the_GUARD_BOTH_FLOAT,_GUARD_BOTH_INT, and_GUARD_BOTH_UNICODE micro-ops, since they just make the abstract interpreter more complicated for not much benefit.

@brandtbucherbrandtbucher added performancePerformance or resource usage interpreter-core(Objects, Python, Grammar, and Parser dirs) topic-JIT labelsMar 27, 2025
@brandtbucherbrandtbucher self-assigned thisMar 27, 2025
@brandtbucher
Copy link
MemberAuthor

As part of this change, get rid of the_GUARD_BOTH_FLOAT,_GUARD_BOTH_INT, and_GUARD_BOTH_UNICODE micro-ops, since they just make the abstract interpreter more complicated for not much benefit.

One nice unintended effect of this:x + x has only guards the type ofx once now, rather than twice.

@brandtbucher
Copy link
MemberAuthor

Looks about0.5% faster. According to the stats, this avoids:

  • 34 million runtimefloat checks (~3% of the total)
  • 695 million runtimestr checks (~29% of the total)
  • 3.344 billion runtimeint checks (~38% of the total)

@brandtbucherbrandtbucher merged commit1a9d4a1 intopython:mainApr 1, 2025
64 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@Fidget-SpinnerFidget-SpinnerAwaiting requested review from Fidget-SpinnerFidget-Spinner is a code owner

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

Assignees

@brandtbucherbrandtbucher

Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagetopic-JIT
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@brandtbucher

[8]ページ先頭

©2009-2025 Movatter.jp