Skip to content
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 color-* performance #6868

Conversation

romainmenke
Copy link
Member

@romainmenke romainmenke commented May 28, 2023

Which issue, if any, is this issue related to?

See:

Is there anything in the PR that needs further explanation?

  • added a fast abort for all color-* rules
  • added some utilities in support of the color-* rules
  • ensures that regexp's in utilities are declared once and then reused.

I don't mind splitting this up into multiple PR's, one for each rule, but the changes are all similar and minor.

I am unsure what the preference is in this project for balancing the extra noise and review work of multiple PR's vs. the clarity of small chunks. I didn't want to open ±10 PR's without prior discussion :)

@changeset-bot
Copy link

changeset-bot bot commented May 28, 2023

🦋 Changeset detected

Latest commit: d0f8541

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
stylelint Patch

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

@Mouvedia
Copy link
Contributor

What about having a utils/interpolation.js with 5 function exports?
e.g. hasLess, hasPsv, hasScss, hasTpl, hasInterpolation
If not, is it a convention to have only one export per file for utils?

@romainmenke
Copy link
Member Author

romainmenke commented May 29, 2023

plugin option before after delta
color-function-notation modern 92.38 ms 79.20 ms -13.18 ms
color-function-notation legacy 90.00 ms 77.35 ms -12.65 ms
color-hex-alpha never 95.99 ms 81.69 ms -14.30 ms
color-hex-alpha always 100.28 ms 89.22 ms -11.06 ms
color-hex-length short 90.23 ms 78.82 ms -11.41 ms
color-hex-length long 93.01 ms 81.54 ms -11.47 ms
color-named always-where-possible 115.72 ms 97.64 ms -18.08 ms
color-named never 117.55 ms 76.44 ms -41.11 ms
color-no-hex true 99.51 ms 91.37 ms -8.14 ms
color-no-invalid-hex true 99.51 ms 91.37 ms -8.14 ms

lib/reference/functions.js Outdated Show resolved Hide resolved
lib/reference/functions.js Outdated Show resolved Hide resolved
lib/rules/color-function-notation/index.js Outdated Show resolved Hide resolved
lib/rules/color-function-notation/index.js Outdated Show resolved Hide resolved
lib/rules/color-function-notation/index.js Outdated Show resolved Hide resolved
lib/rules/color-hex-case/index.js Show resolved Hide resolved
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
romainmenke and others added 4 commits May 29, 2023 16:42
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ask]

@romainmenke
Copy link
Member Author

romainmenke commented May 29, 2023

Will this PR close

No, I've added a todo list to that issue.

Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. LGTM 👍🏼

@romainmenke romainmenke merged commit 76eb8e7 into main May 29, 2023
14 checks passed
@romainmenke romainmenke deleted the fix-color-rules-performance--adaptable-asian-elephant-740c875825 branch May 29, 2023 22:00
@romainmenke
Copy link
Member Author

romainmenke commented May 29, 2023

Thank you for reviewing all this @ybiquitous and @Mouvedia 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants