Fix alpha-value-notation performance with improved benchmark script#6864
Merged
romainmenke merged 9 commits intomainfrom May 29, 2023
Conversation
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 : stylelint/css-parser#2
I was curious about performance and if there were any benchmark tools in place.
I found that the current benchmark script is just checking PostCSS performance, not rule performance in specific. I've refactored this script to separate the initial parsing phase and the plugin processing.
This gives a more relevant result to Stylelint plugins.
I also found that processing Bootstrap only once doesn't give meaningful results.
PostCSS is just too fast, the deviation too high and the actual duration per cycle with or without a code change isn't clear.
I found that duplicating the Bootstrap source 20 times gives a more useful output.
I have a M2 macbook air, which is possibly the worst machine to run benchmarks on.
So someone with a decent machine (no power saving cores, cooled cpu) should verify this work.
This change also adds some improvements to the first rule.
I just picked the first rule at random, not because I noticed anything wrong in terms of performance.
Changes like these do not take away the underlying issue as described in stylelint/css-parser#2
But I do think it is worthwhile to look into and apply trivial improvements like these.
Even with a different style parser it will be a good practice to add fast aborts before doing a deeper AST walk.