RTKQ Typescript Compiler Performance issue #4683
Replies: 5 comments
-
Just to check, what RTK version are you on? We did do some perf improvements to this last year: That was released in https://github.com/reduxjs/redux-toolkit/releases/tag/v1.9.7 . But yeah, if you've got 2600 endpoints, I'm not surprised that's slow. |
Beta Was this translation helpful? Give feedback.
-
Do you experience the same level slowdown in VSCode? IntelliJ doesn't always use the official TypeScript language server, but their own "faster" implementation. |
Beta Was this translation helpful? Give feedback.
-
the benchmarks are generated directly using tsc (Version 5.3.3).
We noticed it with around 30 endpoints because the performance had already degraded to the point where the developer experience suffered. However, the problem grows (almost) linearly with the number of endpoints. with 2600 the typescript language server is not useable any more (~40 sec. delay).
we are on 2.2.1 |
Beta Was this translation helpful? Give feedback.
-
We’re also experiencing bad performance in vscode and sublime-text with around 10 rtkq slices, with 1 to 10 endpoints each. Anytime there is RootState involved making any changes takes the LSP a few seconds to catch up. |
Beta Was this translation helpful? Give feedback.
-
To add another datapoint, we've been transitioning from manual API handling to using RTK Query. The tsserver performance hit is quite significant even at the low end and it would seem scales fairly linearly with the number of endpoints defined. As a test I broke out a small portion of related endpoints into a separate API definition (5 endpoints). Using tsserver tracing I found that it takes between 150-200ms to evaluate the file that holds the api definition (which it's doing because I'm referencing a hook from that api). That's with having forced the typing on RootState and other related bits to I'm trying to figure out where to go from here as intellisense has become so slow that it's not really contributing much at this point but RTK Query is also very effective as a tool. I imagine the impending Project Corsa will bring a lot of benefits here. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I noticed that my IDE takes quite a long time to resolve types. Even when RTKQ isn’t directly involved, tracing shows that it still takes an extremely long time.
Atm. i've around 30 endpoints and it takes 600ms on every keystroke. i tested it with ~300 endpoints and my IDE (and any kind of typechecking) takes ~3500ms. i am using a freaking fast imac studio (...).
with 2600 endpoints it takes 27799ms for intelliJ (phpstorm) to resolve a type (even if RTKQ is not directly involved).
the code is quite simple:
than i've
With just 30 endpoints, you can already feel how the developer experience across the entire project declines. Are we doing something wrong here? For larger projects, this would have to be a showstopper, wouldn’t it?
bench_2600.txt.zip
bench.txt.zip
how to reproduce:
Beta Was this translation helpful? Give feedback.
All reactions