Skip to content

[mypyc] feat: unroll certain for loops with known params #19518

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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

BobTheBuidler
Copy link
Contributor

@BobTheBuidler BobTheBuidler commented Jul 28, 2025

This PR, when finished, will unroll any for loops that iterate across a set of values which are known at compile time

This allows us to entirely bypass any iteration overhead and keep more things in C-space

It also does the same when iterating across the values of any mypyc-defined tuple types, whether the values are known at compile time or not

The generated C code will be longer but more readable with less branching and no iterator overhead, will offer the C compiler many more opportunities for optimization

@BobTheBuidler BobTheBuidler changed the title [mypyc] feat: unroll literal certain for loops with known params [mypyc] feat: unroll certain for loops with known params Jul 28, 2025
@BobTheBuidler BobTheBuidler marked this pull request as ready for review July 28, 2025 01:13
@BobTheBuidler BobTheBuidler marked this pull request as draft July 28, 2025 01:14
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.

1 participant