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 at-rule-property-required-list performance #6865

Conversation

romainmenke
Copy link
Member

@romainmenke romainmenke commented May 27, 2023

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

See:

Is there anything in the PR that needs further explanation?

In this at-rule-property-required-list two types of work were less than ideal :

  • formatting of plugin options
  • nested loops

@changeset-bot
Copy link

changeset-bot bot commented May 27, 2023

🦋 Changeset detected

Latest commit: f007bb2

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

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.

Benchmark on my local machine

M1 MacBook Pro / Node.js v20.2.0

npm run benchmark-rule -- at-rule-property-required-list '{"font-face": ["font-display", "font-family", "font-style"], "page": "margin"}'

Before

Warnings: 20
Mean: 81.61474988235294 ms
Deviation: 6.212360461737067 ms

After

Warnings: 20
Mean: 82.71980147058825 ms
Deviation: 11.136367856858897 ms

@romainmenke
Copy link
Member Author

Yeah, the difference is very small.
There is only a single @page rule in the benchmark source, no @font-face rules.

I am fine with dropping this change.

I also tested with something that has more hits and even then it isn't clear which is faster :

node scripts/benchmark-rule.mjs at-rule-property-required-list { "media": ["width", "height"] }

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.

No problems. Thank you for creating this pull request! 👍🏼

Even if the improvement is small, the new code is more readable and adds a new utility to be able to improve other rules.

@romainmenke romainmenke merged commit 30678bb into main May 29, 2023
14 checks passed
@romainmenke romainmenke deleted the fix-at-rule-property-required-list-performance--sincere-bandicoot-44f1ae6a59 branch May 29, 2023 13:56
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

2 participants