8000 gh-131798: Optimize `_ITER_CHECK_TUPLE` by noamcohen97 · Pull Request #134803 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-131798: Optimize _ITER_CHECK_TUPLE #134803

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

Merged
merged 2 commits into from
May 27, 2025

Conversation

noamcohen97
Copy link
Contributor
@noamcohen97 noamcohen97 commented May 27, 2025

Copy link
Member
@Fidget-Spinner Fidget-Spinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks! Normally we want to add a test verifying the optimization is working too. However, this is a special case --- just to let you know how the tracer currently works, we trace from backwards jumps. Once we see a for loop, we try "closing" the loop. Thus, we would never see _ITER_CHECK_TUPLE except for a nested for loop. However, since the inner loop will always warm up before the outer loop, it will be hard to extract the real trace we want to inspect.

In short, your testing code might look like this:

for i in range(WARMUP):
    for x in (1,2,3):
        pass

but that will generate 2 JIT executors, not just 1, so it will cause us some issues when trying to identify the jitted code.

This is more of a side ramble about the limitations of our testing infrastructure, nothing you can do to fix it till we fix the testing on our side.

@noamcohen97
Copy link
Contributor Author

Thanks @Fidget-Spinner and @tomasr8 for reviewing

@Fidget-Spinner Fidget-Spinner merged commit 79d81f7 into python:main May 27, 2025
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0