-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Performance degradation in 8.1.0: @typescript-eslint/no-unsafe-return with high-cardinality unions #10196
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
Comments
A few things you need to do: First - you've filed an issue saying there's been a perf regression... But you've provided no point of comparison. You say it's gotten slower... But by how much? Is it slower with the exact same config? Or did your config change? You need to provide more information! Next - you've provided a reproduction with all of the recommended rules turned on. That's a massive blast radius for performance and so any meaningful comparisons will be very difficult. You need to slim down the config so that it includes the minimum config to reproduce the issue. Help us to help you by providing a minimal repro with all the information. |
On the surface I would say that this is working as expected. Type information is computed lazily - meaning it is computed only when it's accessed by the tool. TypeScript checks completely different things to what we check (intentionally so!) meaning it requests different type info to what we do. It could just be that we're getting or iterating through more types than TS is. We also can't access the same internals as TS - hence we cannot optimise in the same ways they can. But as mentioned - without more information it's hard to tell much of anything. |
Apologies @bradzacher, I held too much context in my head and didn't write it down! It's near-instant (~1s) in previous versions. I extracted this out of a larger internal repository which was in the process of upgrading, so I didn't have a benchmarks for this minimal reproduction, but I've grabbed that for you below. Apologies for not bisecting the rules - I have done so now, and found that one rule, I've pushed to the reproduction repository to just run Is there anything else I can do to help narrow down the problem? |
Ah interesting; digging further, the issue is not reproducible in 8.0.1 but is reproducible in 8.1.0, so it's not the v8 upgrade. |
Looks like #8693; most of the time is spent in |
I spent some time looking at this with @AaronMoat and think we were able to narrow down the cause. Issue isn't currently taking PRs so I'll just link to the commit. |
that fix certainly looks reasonable. |
Before You File a Bug Report Please Confirm You Have Done The Following...
Issue Description
I haven't exactly narrowed down why yet, but there appears to be a performance degradation in patterns like this:
In the example reproduction, it takes about 73 seconds on my machine.
Note that
tsc
takes 0.7s.Reproduction Repository Link
https://github.com/AaronMoat/typescript-eslint-perf
Repro Steps
yarn install
yarn lint
Versions
typescript-eslint
8.11.0
TypeScript
5.6.3
ESLint
9.13.0
node
v20.17.0
The text was updated successfully, but these errors were encountered: