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

chore: speed up linting #15424

Merged
merged 2 commits into from
Mar 4, 2025
Merged

chore: speed up linting #15424

merged 2 commits into from
Mar 4, 2025

Conversation

benmccann
Copy link
Member

upgrades eslint-plugin-n to get a big speedup from eslint-community/eslint-plugin-n#404

Copy link
Contributor

github-actions bot commented Mar 3, 2025

Playground

pnpm add https://pkg.pr.new/svelte@15424

@svelte-docs-bot
Copy link

@Rich-Harris
Copy link
Member

On main, time pnpm eslint yields the following:

pnpm eslint  11.33s user 1.26s system 165% cpu 7.598 total

On this branch it's reliably two seconds slower:

pnpm eslint  13.22s user 1.67s system 155% cpu 9.582 total

Any insight into why that might be?

@benmccann
Copy link
Member Author

Maybe you just got an unlucky run. The PR is slightly faster for me. Though not a huge difference or as much as I was hoping for

main

> TIMING=20 eslint

Rule                                            | Time (ms) | Relative
:-----------------------------------------------|----------:|--------:
n/prefer-node-protocol                          |   667.067 |    42.3%
no-redeclare                                    |   220.205 |    14.0%
@typescript-eslint/prefer-promise-reject-errors |    86.632 |     5.5%
@typescript-eslint/await-thenable               |    43.962 |     2.8%
svelte/no-unknown-style-directive-property      |    34.126 |     2.2%
@stylistic/quote-props                          |    33.978 |     2.2%
no-misleading-character-class                   |    30.935 |     2.0%
lube/svelte-naming-convention                   |    27.138 |     1.7%
no-global-assign                                |    24.775 |     1.6%
no-loss-of-precision                            |    22.450 |     1.4%
constructor-super                               |    19.411 |     1.2%
no-regex-spaces                                 |    18.656 |     1.2%
no-useless-escape                               |    17.635 |     1.1%
no-control-regex                                |    17.479 |     1.1%
no-useless-backreference                        |    17.237 |     1.1%
no-unreachable                                  |    16.557 |     1.0%
no-this-before-super                            |    15.313 |     1.0%
getter-return                                   |    13.530 |     0.9%
no-fallthrough                                  |    12.448 |     0.8%
no-constant-binary-expression                   |    11.800 |     0.7%

real	0m11.876s
user	0m22.427s
sys	0m0.983s

PR

> TIMING=20 eslint

Rule                                            | Time (ms) | Relative
:-----------------------------------------------|----------:|--------:
no-redeclare                                    |   251.149 |    25.2%
@typescript-eslint/prefer-promise-reject-errors |    93.850 |     9.4%
@typescript-eslint/await-thenable               |    46.419 |     4.7%
@stylistic/quote-props                          |    37.515 |     3.8%
n/prefer-node-protocol                          |    35.682 |     3.6%
svelte/no-unknown-style-directive-property      |    29.912 |     3.0%
no-global-assign                                |    26.144 |     2.6%
no-loss-of-precision                            |    21.852 |     2.2%
no-misleading-character-class                   |    21.371 |     2.1%
constructor-super                               |    19.830 |     2.0%
lube/svelte-naming-convention                   |    19.491 |     2.0%
no-regex-spaces                                 |    18.766 |     1.9%
no-this-before-super                            |    18.357 |     1.8%
no-useless-escape                               |    17.388 |     1.7%
no-unreachable                                  |    16.217 |     1.6%
no-restricted-properties                        |    15.321 |     1.5%
no-control-regex                                |    14.159 |     1.4%
getter-return                                   |    13.916 |     1.4%
no-obj-calls                                    |    13.617 |     1.4%
no-constant-condition                           |    13.241 |     1.3%

real	0m11.092s
user	0m20.734s
sys	0m0.901s

@Rich-Harris
Copy link
Member

It's very consistent for me

@Rich-Harris
Copy link
Member

The rule in question is definitely much faster, and it looks like most other rules are faster too, but there's been some sort of regression elsewhere.

main:

Rule                                            | Time (ms) | Relative
:-----------------------------------------------|----------:|--------:
n/prefer-node-protocol                          |   418.174 |    42.3%
no-redeclare                                    |   160.037 |    16.2%
@typescript-eslint/prefer-promise-reject-errors |    58.555 |     5.9%
@typescript-eslint/await-thenable               |    24.951 |     2.5%
svelte/no-unknown-style-directive-property      |    23.263 |     2.4%
@stylistic/quote-props                          |    21.338 |     2.2%
no-misleading-character-class                   |    13.836 |     1.4%
no-this-before-super                            |    12.635 |     1.3%
lube/svelte-naming-convention                   |    12.396 |     1.3%
no-constant-binary-expression                   |    12.217 |     1.2%
no-global-assign                                |    11.225 |     1.1%
no-fallthrough                                  |    10.285 |     1.0%
no-useless-escape                               |    10.222 |     1.0%
no-loss-of-precision                            |     9.492 |     1.0%
no-regex-spaces                                 |     9.320 |     0.9%
constructor-super                               |     9.311 |     0.9%
no-unreachable                                  |     8.604 |     0.9%
no-control-regex                                |     8.494 |     0.9%
@typescript-eslint/no-unused-expressions        |     7.660 |     0.8%
no-import-assign                                |     6.889 |     0.7%
TIMING=20 pnpm eslint  12.71s user 1.51s system 154% cpu 9.223 total

This branch:

Rule                                            | Time (ms) | Relative
:-----------------------------------------------|----------:|--------:
no-redeclare                                    |   141.215 |    26.9%
@typescript-eslint/prefer-promise-reject-errors |    53.259 |    10.2%
svelte/no-unknown-style-directive-property      |    28.587 |     5.5%
@typescript-eslint/await-thenable               |    26.335 |     5.0%
@stylistic/quote-props                          |    18.304 |     3.5%
n/prefer-node-protocol                          |    17.226 |     3.3%
no-misleading-character-class                   |    11.908 |     2.3%
no-global-assign                                |    11.117 |     2.1%
constructor-super                               |    10.786 |     2.1%
lube/svelte-naming-convention                   |    10.782 |     2.1%
no-regex-spaces                                 |     8.328 |     1.6%
no-useless-escape                               |     8.209 |     1.6%
no-loss-of-precision                            |     8.195 |     1.6%
no-control-regex                                |     7.520 |     1.4%
no-constant-binary-expression                   |     7.019 |     1.3%
no-unreachable                                  |     6.997 |     1.3%
@typescript-eslint/no-unused-expressions        |     6.544 |     1.2%
no-this-before-super                            |     6.472 |     1.2%
getter-return                                   |     5.990 |     1.1%
@typescript-eslint/triple-slash-reference       |     5.579 |     1.1%
TIMING=20 pnpm eslint  13.79s user 1.84s system 149% cpu 10.423 total

Copy link

changeset-bot bot commented Mar 4, 2025

⚠️ No Changeset found

Latest commit: 58cbd9e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@benmccann
Copy link
Member Author

sigh. nothing is ever easy. we might as well merge this so that we're on the latest and then I can try to track down whatever's going on with the config loading or whatever is causing the slowness. running the lint rules supposedly only takes 1s, so I don't know where all the other time is going

@Rich-Harris Rich-Harris merged commit b28b013 into main Mar 4, 2025
10 checks passed
@Rich-Harris Rich-Harris deleted the eslint-speedup branch March 4, 2025 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants