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

xo --fix very slow #558

Closed
StarpTech opened this issue Jun 10, 2021 · 6 comments
Closed

xo --fix very slow #558

StarpTech opened this issue Jun 10, 2021 · 6 comments

Comments

@StarpTech
Copy link

StarpTech commented Jun 10, 2021

Reproduction

Run npm run lint:fix in https://github.com/StarpTech/apollo-datasource-http

Running on around ~5 files takes more than a second on very performant hardware.

Constraints

  • AMD Ryzen 9 5950X 16-Core Processor, 3401 Mhz, 16 Core(s), 32 Logical Processor(s),
  • 64GB RAM 3000Mhz
  • NVMe
  • Ubuntu (WSL2)
❯ time xo --fix
xo --fix  2.96s user 0.21s system 149% cpu 2.127 total
@sindresorhus
Copy link
Member

The main problem is that TypeScript ESLint (and TypeScript) is very slow, and I did notice it got extra slow in the past few months. I haven't yet had the time to dig into what caused it.


Also seems like the prettier config slow things down:

❯ TIMING=1 xo --fix
Rule                                             | Time (ms) | Relative
:------------------------------------------------|----------:|--------:
prettier/prettier                                |   344.571 |    40.9%
ava/no-import-test-files                         |    93.161 |    11.0%
@typescript-eslint/no-floating-promises          |    87.586 |    10.4%
@typescript-eslint/return-await                  |    56.237 |     6.7%
import/namespace                                 |    48.292 |     5.7%
@typescript-eslint/no-confusing-void-expression  |    33.194 |     3.9%
@typescript-eslint/no-unused-vars                |     8.934 |     1.1%
unicorn/prefer-string-slice                      |     6.955 |     0.8%
@typescript-eslint/no-unnecessary-type-assertion |     6.687 |     0.8%
@typescript-eslint/await-thenable                |     5.755 |     0.7%

@StarpTech
Copy link
Author

Thanks for the quick evaluation. I'll try to disable prettier.

@StarpTech
Copy link
Author

StarpTech commented Jun 10, 2021

Also seems like the prettier config slow things down:

The sum doesn't reflect the execution time. Is there a way to enable other metrics?

I disabled prettier but it has no significant impact compared to total.

❯ time TIMING=1 xo --fix
Rule                                            | Time (ms) | Relative
:-----------------------------------------------|----------:|--------:
prettier/prettier                               |   357.208 |    40.7%
@typescript-eslint/no-floating-promises         |   101.728 |    11.6%
ava/no-import-test-files                        |    63.628 |     7.2%
@typescript-eslint/return-await                 |    56.333 |     6.4%
@typescript-eslint/no-confusing-void-expression |    45.433 |     5.2%
import/namespace                                |    30.714 |     3.5%
@typescript-eslint/no-unused-vars               |    13.589 |     1.5%
unicorn/prefer-string-slice                     |     9.937 |     1.1%
@typescript-eslint/await-thenable               |     8.130 |     0.9%
@typescript-eslint/no-unnecessary-qualifier     |     7.865 |     0.9%
TIMING=1 xo --fix  4.35s user 0.22s system 149% cpu 3.062 total

@sindresorhus
Copy link
Member

Is there a way to enable other metrics?

No, the metrics are provided by ESLint and is about rule-only performance.

@sindresorhus
Copy link
Member

To get any other metrics, someone will need to run the XO run in DevTools and look at the flame graph.

@fregante
Copy link
Member

fregante commented Aug 6, 2022

Tracking in #515

@fregante fregante marked this as a duplicate of #515 Aug 6, 2022
@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2022
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

No branches or pull requests

3 participants