New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix no-descending-specificity
performance
#7026
Fix no-descending-specificity
performance
#7026
Conversation
🦋 Changeset detectedLatest commit: b81d660 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this was the slowest rule I encountered while taking a pass at #6869. So, it's great to see this improvement.
(I saw your performance-related pull request upstream in PostCSS too. Excellent stuff.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great improvement! 👏🏼
Rule#selectors
property actually has some calculation. Honestly, I feel it's hard to notice it... 😓
https://github.com/postcss/postcss/blob/8.4.24/lib/rule.js#L13-L15
Sorry for the conflict in the test file due to #7024. Could you resolve the conflict, please? 🙏🏼 |
…cificity-performance--considerate-avocet-12abeeb86a
See #6869
This rule warned multiple times for the same selector.
It would emit one warning for each selector with lower specificity that preceded the current selector.
I don't think this is very useful as it just causes extra noise.
With this change this rule will only emit a single warning for each selector.
It will always reference the earliest other selector with lower specificity.
All these extra warnings came at a cost.
fewer warnings -> faster execution.
I've also added extra tests to cover this scenario.
before :
after :
The excessive number of warnings is the result of the duplicate CSS in the test source.
Ideally we would have a large, but well formed and realistic benchmark source.