-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
Conditional backward edges should help "warm up" code #93554
Copy link
Copy link
Closed
Labels
3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Fields
Give feedbackNo fields configured for issues without a type.
#93229 introduced a regression in how aggressively we quicken some
forloops. Minimal example: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 on unconditional backwards jumps, not on conditional ones.We've known about this limitation for some time, in particular with regard to
whileloops. Since we check the loop condition at the bottom ofwhileloops, one call is not enough to quickenw:@markshannon has expressed a preference for having all branches be forward (i.e. replacing backward
POP_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