Intellisense unbearably slow
I have a decently large project setup with T3 stack, with a lot of inferred trpc routes. The intellisense is literally almost unusable, and the type checker is unbearably slow.
- Getting an import into the "quick fix" takes about 10 seconds on avarage
- Getting an error to show in my editor from typescript takes about 6 seconds after a change (checked via ts logs, it's fairly consistent 6seconds).
- Intellisense stays at loading for a good 3-4 seconds before anything even pops up.
I have no clue where to debug this. I'd appreciate some pointers on why this is so unbearably slow. Is this just the nature of trpc/prisma/zod or something??
Things I've done:
- Disable all extensions
- Try it on my home pc as opposed to work laptop. (work laptop is running on arch, pc on windows/wsl2)
- Tried fresh node_modules.
- Node modules is excluded in ts file, ts strict mode is enabled.
- Tried vscode instead of webstorm. Equally slow.
14 Replies
I moved from VSCode to webstorm and it fixed all my TS perf problems, sounds like you tried that already
In general, inferred types are really slow, also lots of extends on your zod types slows things down - it’s just how the T3 stack is unfortunately
https://twitter.com/whizzaf/status/1683998923382304768 you can try this which adds a build step to tRPC speeding things up
Oh I will definitely try that, that sounds nice. But I want to point out the issue is also outside of trpc routes, it's in literally any .tsx/ts file in my project, after making a type error it takes about 6 seconds before that type error even shows up and by then i've probably scrolled way past it.
@xaohs if you find a solution please keep me posted. its driving me nuts. im just about to try out webstorm and see if much better
Give ts more ram
webstorms got a free trial, just use it with vscode keybindings and a vscode theme and cope
is there a way to give ts more ram? ill chuck that boi whatever it needs
i gave it 6gb instead of 3 on vscode
i just went to settings and searched for memory
the only option was ts server
i give 6144 mb aka 6gb
Sounds to me like a RAM issue. How much RAM is being used when it's slow?
Especially because you are using WSL2
last them I used an intelij editor with vscode keybinds they straight up just didnt work lmfao.
If you're running in wsl I would defo give more ram to both wsl and tsserver. I found that helped a lot with my issues
ive chucked vscode 12gb of ram over default 3gb, should be more than enough. will see over time how it goes. but i think its doing a bit better.
I gave it 16gb ran
Its happening on any project with trpc. I get a giant linter error and my linter refuses to work in trpc files. I really want to use webstorm for my t3 projects, since it's my usual IDE
I have spent hours trying to fix this issue and still have yet to come to a solution. It's also happening on my linux based system as well as my windows based system and only having issues with the t3 stack projects
Try to find the source. Check your resources. Is the RAM the bottleneck? Shut things off step by step. TS, ESLint, ...
No nothings bottlenecking, got a monster pc and laptop. Yeah I tried shutting things off and shutting ts off fixed it
But I can't fix ts, the issue doesn't seem to stem from bottlenecking issues nor ram and stuf
increasing my ram did help but more just in those really bad situations where clearly didnt have any memory left. Ive run code --status and can clearly see i can exceed 3gb default quite often. However sadly just still normal use isnt quick. Frequently waiting 5-20sec for intellisense.
Webstorm was sometimes better and then othertimes just didnt give any suggestions even after waiting like 30+sec