Repository navigation
Shrink ParserState - #457
Merged
Merged
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...
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
lando-worker Bot
pushed a commit
to mozilla-firefox/firefox
that referenced
this pull request
Oct 7, 2026
…ystem-reviewers,supply-chain-reviewers,dshin This needs a tweak in servo/ for a behavior change on how arbitrary substitution functions are dealt with, see the discussion in servo/rust-cssparser#456. I wanted to do this once servo/rust-cssparser#457 was reviewed but that's taking a while and I need to work on other bugfixes too, so landing the update to main first. Differential Revision: https://phabricator.services.mozilla.com/D331712
github-actions Bot
pushed a commit
to DioxusLabs/stylo
that referenced
this pull request
Oct 8, 2026
…ystem-reviewers,supply-chain-reviewers,dshin This needs a tweak in servo/ for a behavior change on how arbitrary substitution functions are dealt with, see the discussion in servo/rust-cssparser#456. I wanted to do this once servo/rust-cssparser#457 was reviewed but that's taking a while and I need to work on other bugfixes too, so landing the update to main first. Differential Revision: https://phabricator.services.mozilla.com/D331712
nicoburns
approved these changes
Oct 8, 2026
nicoburns
left a comment
Contributor
There was a problem hiding this comment.
Definitely in the territory of "should only do this in a hot loop". But it sounds like that's the case here.
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).
emilio
force-pushed
the
shrink-parserstate
branch
from
October 8, 2026 16:55
f3ad62b to
e48c2c3
Compare
…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
October 8, 2026 16:58
e48c2c3 to
29b5987
Compare
emilio
enabled auto-merge
October 8, 2026 16:59
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.