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

Optimizing FOR_ITER bytecode #91432

Closed
Closed
Labels
3.11only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usage
@sweeneyde

Description

@sweeneyde

We can execute one less opcode in every iteration (except for the first) of every for-loop by changing from

    GET_ITERtop:    FOR_ITER    [body]    JUMP_BACKWARDS(top)cleanup:end:

to

    GET_ITER    JUMP_FORWARD(bottom)body:    [body]bottom:    FOR_END(body)cleanup:end:

This was suggested by@markshannonhere, but it appears to be similar in spirit toLoop Inversion.

There seems to be a small (on the order of 1%) benefit, but I imagine the benefit will be magnified after any specialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp