perf(postcss-discard-duplicates): bucket rules by selector - #1815
Merged
ludofischer merged 1 commit intoJun 8, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1815 +/- ##
==========================================
- Coverage 98.82% 98.80% -0.02%
==========================================
Files 124 126 +2
Lines 10776 11305 +529
Branches 15 15
==========================================
+ Hits 10649 11170 +521
- Misses 127 135 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ludofischer
force-pushed
the
perf/discard-duplicates-bucket
branch
from
June 8, 2026 20:59
693b090 to
7d8bcc3
Compare
ludofischer
approved these changes
Jun 8, 2026
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.
What
Replaces the O(N²) duplicate-rule scan in
postcss-discard-duplicateswith a single selector-bucketing pass: each rule dedupes only against earlier rules sharing its selector instead of scanning every preceding sibling.Full default preset over a corpus of 21 released framework CSS files (master = 100% of current time, lower is faster):
The scan is quadratic even when there are no duplicates, so the win grows with rule count. Synthetic stylesheets of N distinct-selector rules (this plugin only):
Document order and last-wins semantics are unchanged.