Repository navigation
[perf] Further shrink the size of AbstractLineToken - #982
Merged
Merged
Conversation
AbstractLineToken
reese
force-pushed
the
reese-conditional-layout-size
branch
from
October 23, 2026 07:03
17fa972 to
24ee9da
Compare
reese
marked this pull request as ready for review
October 23, 2026 08:30
reese
force-pushed
the
reese-conditional-layout-size
branch
from
October 23, 2026 11:06
24ee9da to
394b9ed
Compare
reese
force-pushed
the
reese-conditional-layout-size
branch
from
October 23, 2026 11:33
394b9ed to
0bd9df6
Compare
reese
force-pushed
the
reese-conditional-layout-size
branch
2 times, most recently
from
October 23, 2026 11:35
2c6a5fb to
a078f46
Compare
reese
force-pushed
the
reese-conditional-layout-size
branch
from
October 23, 2026 11:41
a078f46 to
9c2b32d
Compare
reese
force-pushed
the
reese-conditional-layout-size
branch
from
October 23, 2026 13:12
9c2b32d to
974fd06
Compare
reese
force-pushed
the
reese-conditional-layout-size
branch
2 times, most recently
from
October 23, 2026 23:26
df751bf to
1c5b346
Compare
reese
force-pushed
the
reese-conditional-layout-size
branch
from
October 24, 2026 06:35
1c5b346 to
4b93ba9
Compare
froydnj
approved these changes
Oct 24, 2026
| let mut tokens = tokens.into_iter(); | ||
|
|
||
| for token in self.statement_tokens { | ||
| for token in tokens.by_ref().take(predicate_start) { |
Collaborator
There was a problem hiding this comment.
I kind of wish there was a better way of consuming self here so that the abstraction of predicate and statement tokens would not have to leak into write_inline_tokens and write_block_tokens. Like the consumption of self above would actually return two iterator-ish things directly, rather than manually splitting here.
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.
This is another change to try and shrink the token target types, in this case
ConditionalLayoutEntry.ConditionalLayoutEntrycurrently holds two vectors, a pointer to the keyword slice, an indent depth (u32), and the phase enum. This PR combines the two vectors into one (and storing an index where the two diverge) and then storing the keyword as an enum, such as we did for delimiters in #981. This gets it down to 40 bytes each, which gets our overall memory usage down another ~15%.