Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Tracked by #122548
markshannon opened this issue Dec 31, 2024 · 0 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@markshannon
Copy link
Member

markshannon commented Dec 31, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants