Description
Bug Report
It seems like a fairly significant performance regression was introduced in this #48044, which was shipped in TS 4.7. In TS 4.6, it takes ~30 seconds to run yarn tsc
in our repo, and the reported strict subtype cache size is 24_011. In TS 4.7, it takes 75+ seconds to run yarn tsc
(~2.5x longer than previous), and the reported strict subtype cache size is 122_778 (~5x larger than previous).
I verified that it was that specific PR that regressed the performance by taking a locally-installed 4.6.4 and applying the changes from that PR directly.
Another symptom is that several types (mostly spreads of objects into others) are now reporting as "Expression produces a union type that is too complex to represent."
🔎 Search Terms
Expression produces a union type that is too complex to represent
, strict subtype cache size
🕗 Version & Regression Information
- Regressed in fix(48034): Get a literal string of type intersection in a template literal type #48044
- This changed between versions 4.6.4 and 4.7.3
Version | Time | Strict Subtype Cache Size |
---|---|---|
4.6.4 | 33s | 24011 |
4.7.3 | 75s | 122778 |
4.9.4 | 77s | 122869 |
5.0.0-dev.20230120 | 78s | 122869 |
💻 Code
I haven't been able to narrow down a minimal reproduction of this issue, but if someone points me in the right direction I'm happy to work on it.
🙁 Actual behavior
Running yarn tsc --noEmit --extendedDiagnostics
takes ~75 seconds in our repo, with a Strict subtype cache size of 122778.
🙂 Expected behavior
Running yarn tsc --noEmit --extendedDiagnostics
takes ~30 seconds in our repo, with a Strict subtype cache size of 24011.