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

Conditional backward edges should help "warm up" code #93554

Closed
Assignees
iritkatrielbrandtbucher
Labels
3.12only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagetype-bugAn unexpected behavior, bug, or error
@brandtbucher

Description

@brandtbucher

#93229 introduced a regression in how aggressively we quicken somefor loops. Minimal example:

deff(x:bool)->None:foriinrange(1_000_000):ifx:pass

f(True) will quicken this code, butf(False) will not, even though both contain the same number of back edges. The issue is that we only quicken onunconditional backwards jumps, not on conditional ones.

We've known about this limitation for some time, in particular with regard towhile loops. Since we check the loop condition at the bottom ofwhile loops, one call is not enough to quickenw:

defw()->None:i=0whilei<1_000_000:i+=1

@markshannon has expressed a preference for having all branches be forward (i.e. replacing backwardPOP_JUMP_IF_FALSE(x) instructions withPOP_JUMP_FORWARD_IF_TRUE(1); JUMP_BACKWARD(x) in the assembler).@iritkatriel believes that this shouldn't be too difficult, based on recent assembler rewrites.

CC@sweeneyde

Linked PRs

Metadata

Metadata

Labels

3.12only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagetype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp