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

Handle very large .emb files. #215

Merged
merged 4 commits into from
Dec 21, 2024

Conversation

reventlov
Copy link
Collaborator

This change switches parse tree handling to use iteration (with an explicit stack) instead of recursion, which:

  • Allows large (>~1000 entity) .emb files to be formatted.
  • Allows very large (>~16k entity) .emb files to be compiled.

The difference in sizes in the previous code was due to module_ir.py hackily increasing the recursion limit: while this more or less worked, it was a little dangerous (it ran the risk of blowing out the C stack, depending on platform) and only increased the limit. This change removes the limit entirely (at least, up to the available memory on the system).

This change switches parse tree handling to use iteration (with an
explicit stack) instead of recursion, which:

*   Allows large (>~1000 entity) `.emb` files to be formatted.
*   Allows very large (>~16k entity) `.emb` files to be compiled.

The difference in sizes in the previous code was due to `module_ir.py`
hackily increasing the recursion limit: while this more or less worked,
it was a little dangerous (it ran the risk of blowing out the C stack,
depending on platform) and only increased the limit.  This change
removes the limit entirely (at least, up to the available memory on the
system).
Copy link
Collaborator

@jasongraffius jasongraffius left a comment

Choose a reason for hiding this comment

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

LGTM

@reventlov reventlov merged commit 1827594 into google:master Dec 21, 2024
6 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.

2 participants