Conversation
emilio
force-pushed
the
shrink-parserstate
branch
from
September 20, 2026 16:29
27e60f5 to
be03de8
Compare
Member
Author
|
A less ugly alternative for the last commit might be to just reduce the line count to a |
Member
Author
emilio
commented
Sep 20, 2026
| /// Current line number shifted by `Self::BLOCK_TYPE_BITS`, with the low 2 bits holding the | ||
| /// `BlockType` discriminant of the block the last returned token opened (if any). | ||
| line_number_and_block_type: u32, | ||
| } |
Member
Author
There was a problem hiding this comment.
Further microbenchmarking showed that most of the win (on those microbenchmarks at least) comes from making the Clone impl a memcpy rather than a per-field copy (why does rustc not collapse everything onto a memcpy without derive(Copy), I don't know)...
Making it smaller is a smaller win on top, so maybe we should just take this anyway, since I think it's not too complicated...
We already truncate column numbers to u32, so this gives the same answer it would otherwise give, and saves some storage (not in this patch because ParserState is still 24 bytes, but we can improve on that in a bit).
…k type. The line number range gets a bit smaller, but it pays off by making state restoration faster, which is a lot hotter.
emilio
force-pushed
the
shrink-parserstate
branch
from
September 21, 2026 17:13
be03de8 to
f3ad62b
Compare
emilio
marked this pull request as ready for review
September 21, 2026 17:13
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.
See the two commits. This improves state restoration performance which is pretty hot.