Skip to content

Performance of instrumented FOR_ITER is poor as DISABLE doesn't remove the instrumentation. #128375

Closed
@markshannon

Description

@markshannon

Disabling the "not taken" branch of an instrumented FOR_ITER does not de-instrument the FOR_ITER, it only de-instruments the NOT_TAKEN which prevents specialization and JIT compilation of the FOR_ITER. It is only when the loop exits, that the FOR_ITER is de-instrumented.

Instead of instrumenting the FOR_ITER we could instrument the POP_TOP at the end of the loop.
This will add an extra instruction dispatch when exiting the loop, as FOR_ITER and its specializations will need to jump to the POP_TOP instead of over it. We already do this in tier2, so the overhead should be negligible, and it might simplify the code a bit.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions