-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Semantic highlighting (encodedSemanticClassifications-full
) extremely slow
#44851
Comments
Same issue here, will try downgrading and see if that helps at all. |
This comment has been minimized.
This comment has been minimized.
Please either share a project that causes this or try collecting the TS Server log:
If you can share the log, I can a look to see if anything stands out
|
I'm sharing a log about this issue, seeing it on the last update and even without extensions enabled: |
There are instances of
Only followed by some open files (+2 seconds):
|
Attached my log file |
I also noticed with affected version that even if I manage to load the list of hints, it is not complete. |
Reverting to 1.56 fixed the slowness for me too. Didn't seem to matter if I used TS 4.2 or 4.3. |
Can confirm, I also had to revert to 1.56. |
Had the same problem. .vscode/settings.json:
|
how was the result after disabling the feature? |
Well, I use only IntelliSense for faster coding and with this feature disabled I do not waiting for 5-15 sec to get suggestions. If I have some errors with types or any other mistakes in source code I get errors while my project recompiles. |
Update: this may be related to TypeScript 4.3? After updating our codebase to TS43 VSCode's Intellisense has slowed down to a crawl even when using 1.56.2. |
Update: after several days Intellisense became slow again. |
After investigation I found an issue related to my project. I don't know will it works for others. |
I have this same issue on 1.57 and 1.58 (Insider) VSC, noticed Intellisense in VS code slowing down significantly. Downgrading to Typescript 4.2 seems to speed things up by a factor of 10. Server log attached. |
The slowness is caused by PR #30639. I'm still looking at options on how to avoid this. |
Alright I've been looking into it and seems like it's going to be complicated to optimize. All the problem is that typescript is doing a bit more work to relate conditional types (in this example the problem is with type Nevertheless, we can still get into a good performance by dividing the type into sub named types. I've done some tests and manage to get Check the gist with how the file look after testing: https://gist.github.com/armanio123/95a33f9ad3286a7d78590eb11af293c4 I don't know much about the project, so all my types on the example are named just an alphabet letter. |
I'm not using Ajv in my system though. If it's a widespread issue, should it be highlighted as a breaking change so that library maintainers can update their types accordingly? Barring that, the PR should be reverted? |
I have reported this issue, but I also do not use |
Is it possible a package in your project has ajv as a dependency? Coule you please confirm by looking at package-lock.json or yarn.lock? |
Why is this closed? It's not fixed even in latest version. I still see significant performance regression. |
TypeScript: 4.5.4 It takes about 6-7 seconds after my identifier is correctly marked not found and another 6-7 seconds to erase the red line after I correct it. https://youtube.com/shorts/dLvwjE8zEe8?feature=share This is a moderately sized project (50000 lines) with 20-30 imports and the file is around 200 lines. |
I'm using react-hook-form as well, and I'm also having this issue, upgrading to typescript 4.5 doesn't fix the issue |
Please file a new issue with detailed reproduction steps, a TS Server log, and comparison with a recent version of TS that’s faster. |
May help someone. Added the below to my package.json
and included the below in my settings.json
I use watch in a split terminal for type checking while I code. A bit less convenient but it's basically instant now vs 10-30+ seconds for something such as renaming a symbol or importing |
Hey team, I'm also experiencing this in the latest one. I'm not sure why it's closed? Doesn't happen on my mac though. It only happens on my PC (windows). When i press save, it takes 4-5s for typescript to update the errors in my vscode |
I'm experiencing the same issue. Opening up Htop it seems like only 1 processor is being used to 100% while other processors are just idling. Any ideas? I'm on WSL2 |
@nickwang0808 The language service is single threaded, so I would only expect to see one core used. As Andrew suggested a bug, can you please file a new issue with detailed reproduction steps, a TS Server log, and comparison with a recent version of TS that’s faster. |
Hmm, I'm trying to figure out a way to repro it, it has to be a fairly large repo. |
@nickwang0808 I'm not aware of a comprehensive write-up but the fundamental problem is that coordinating worker threads requires async (or an equivalent mechanism), which would spread virally through the codebase (there's no escape hatch where you can just say "wait for the async thing" and go back to being synchronous), breaking all of our public APIs. It would also require substantial re-architecture, since there's a lot of mutation (for perf reasons) that wouldn't play nicely with multiple threads. TL;DR: We'd have to make an enormous, API-breaking code change and getting back to the current level of performance would be challenging |
OK so I just ran a test on a MacOS machine with same repo. autocomplete uses all thread, where as my machine windows-wsl2 uses only 1 thread. It was instant autocomplete on the macos where mine was around 3 sec. https://www.reddit.com/r/vscode/comments/rgvgyc/comment/htv8dfo/?utm_source=share&utm_medium=web2x&context=3 Also tried to install vscode directly to wsl2 and use the wsl2 gui feature, seems to be using all cores and very snappy too. |
The number of threads is the same on every platform. It is, however, true that there is a helper process that will provide approximate answers until the language service is finished initializing, so it's possible that you're seeing that helper process consume a core and provide a quick answer. In some circumstances, there may also be helper processes to download type definitions automatically, but the language service proper will still use only one core. |
Here is a side by side of native windows vs WSL2 the pattern is WSL2 will max out 1 CPU and everything will block, whereas windows will use all cores unless they are all maxed out it won't block So I'm not sure where to look, can you point me to the right direction? |
Can you elaborate? I'm not sure what you're looking for. If your basic question is "why is the language service slower on WSL2 than on the host windows machine?", some possible causes include:
It might also be worthwhile to determine which processes are using your cores on Windows because they can't all be the LS process. |
Getting the same issues here. 150+ file project. Weirdly enough its only on Windows. I have an M1 Mac which receives sub 1s Typescript results yet my Windows PC (8 core, 3GHz) takes 30 seconds for almost every change. TSServer on both devices run at 4096mb of memory |
Same here, also using |
Using combination of prisma, trpc, zod, react-hook-form. About 12 prisma models so I guess its a lot of generated code. TS version 4 and 5 destroy my CPU with constant 100% utilization. If I downgrade to TS version < 4.5 the issue goes away but I lose all the type inference (zod requires 4.5+) :/ Please fix performance issue Edit: I think I figured out a workaround, downgrading to zod 3.19.1 and TS 4.1, seems like the issue is fixed for me |
Also experiencing these performance issues on Windows. Wondering why this was closed without any real resolution? Happy to run specific tests, but I am also using Prisma and Zod on a large monorepo |
This comment was marked as off-topic.
This comment was marked as off-topic.
@TheRealFlyingCoder (and others) If you are still seeing performance problems, please open a new issue against TypeScript with an example project which demonstrates the issue. Thanks |
Does this issue occur when all extensions are disabled?: Yes
In 1.57.0-1623259737 version IntelliSense is terribly slow. I've no Idea, what more details should I provide. I've tested it on TypeScript/React project (also with all extensions disabled - with the same result - loading hint takes more than 10 seconds).
After downgrade to 1.56.2-1620838498 everything works great.
The text was updated successfully, but these errors were encountered: