Repository navigation
Conversation
Author
|
Feel free to mark the message from @abdulhamid999 as low quality. Irresponsible clanker driver. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In antithesishq/bombadil we keep hitting limits from stack usage.
This PR boxes some of the larger variants.
Expressionis atm 192B because six function-expression variants are stored inline (FunctionExpressionalone is 192 B). EveryExpression, even a literal, pays for that, and the recursive-descent parser moves and returns these values at every level. That accumulates quickly on deeply nested input.E.g in a dev build, 13 nested parentheses are enough to overflow a 2 MiB thread stack.
Results, measured on a ~real-world bundle (a Bombadil spec) and a nested-parentheses microbenchmark:
size_of::<Expression>()size_of::<Statement>()The allocation count goes up slightly (12,757 → 12,894) in my benchmarks, but total bytes allocated drop by about ~30%.
Note: this is a breaking change for anyone who matches on these
Expressionvariants or builds them directly, since the type itself changed.