rule_order: drop shadowed declarations in one backward pass - #218
Open
samoht wants to merge 1 commit into
Open
Conversation
For every declaration of every rule the shadow check rescanned the whole tail, serialising each later rule's selector again to compare it. Walking backwards and carrying a per-selector set of the properties written later answers the same question with a lookup.
samoht
force-pushed
the
speed-canonical-diff
branch
from
July 30, 2026 01:02
d4ca5a5 to
2f39985
Compare
samoht
force-pushed
the
speed-canonical-pass
branch
from
July 30, 2026 01:02
fc60add to
69d965b
Compare
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.
canonicalize_rule_orderon a 660KB stylesheet went from 2.90s to 0.62s, with byte-identical output.drop_shadowed_declarationsasked, for every declaration of every rule, whether any later rule with the same selector writes that property, and answered by rescanning the whole tail and serialising each later rule's selector again. Walking the list backwards and carrying a per-selector set of the properties written later answers the same question with a lookup.This is a regression against 1.0.0 rather than a long-standing cost: the function arrived in 923d09f, after the release. On the same input 1.0.0 takes 22.5s end to end and current main 34.5s; this branch is 24.0s while doing strictly more work in the projection than 1.0.0 did.
Stacked on #217; review that first.