-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
High CPU usage spikes when doing virtually anything in JS/TS files (M2 Mac) #173989
Comments
Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.75.1. Please try upgrading to the latest version and checking whether this issue remains. Happy Coding! |
I had no issue with 1.75.0 but after upgrading to 1.75.1 VSCode is idling at 35-50% CPU usage on an M1 MacBook Air, even off screen in a different desktop without any interaction and all tabs closed. According to "Process Explorer" in VSCode its the Shared Process that it taking up that CPU Usage
Output from "Copy All" on that process
I only noticed when I saw that the CPU was at 46-47 degrees. |
Does this reproduce in the latest VS Code insiders build with all extensions disabled? @tarasis Can you please open a different issue for your problem |
Yes it does, same issue. |
@mjbvz any ideas on why this could be happening? |
Yes. For me, if I re-open VSCode with X file open then I have the issue, but if I have txt or md files open then I don’t have the issue.
… On 26 Feb 2023, at 18:48, Viggo Bryant-Frost ***@***.***> wrote:
@mjbvz any ideas on why this could be happening?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
Yeah same here, small very lightweight files like md or txt files do not bring out the issue but my large JS/JSX files have the issue; simply typing one character sends CPU temps from 30-38C to over 50C. However when idle/in a different desktop the issue does not occur, only when actively editing. |
@Viggo2 Minimap might be the cause. Disable Minimap. See #169775 (comment) Related to #148226 |
Doesn't appear to make much difference I'm afraid |
@tamuratak I've been experimenting with different file types and it seems that the issue seems to be isolated to JavaScript files (mine tend to be quite large and include JSX). When editing in other files, of similar sizes, in my React/Next site, CPU temperatures and usage remain stable. Even when starting completely blank, new JS files, the CPU usage rises and fluctuates a lot more than when editing in, eg, massive CSS files. Fyi extensions attached below, but to me these don't largely seem applicable to this issue. |
@tamuratak @mjbvz Have been further experimenting and it appears the JS/TS Language Features built-in extension is the culprit - disabling it stops the CPU spikes. However, I'd like to have it enabled so are there any settings you know of within it that could improve performance if disabled/enabled? (so far I've tried setting |
Same above. I have followed this guide to identify the culprit https://apple.stackexchange.com/questions/351761/vs-code-code-helper-process-using-more-than-100-cpu-on-macos. Every time I trace something, force stop some process from the activity monitor and the CPU usage goes down, I disable the extension. However this doesn't seem to be tied to the extensions themselves as it keeps happening. Extensions I have disabled so far: What is common among those processes is they are using the TS language server: ps aux | grep 13314
user 13314 88.5 3.9 447380960 652064 ?? R 10:35AM 16:14.17 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node --max-old-space-size=3072 /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /var/folders/y0/x5lk6gms0k3115_pbkvw59n40000gn/T/vscode-typescript501/8cdb3bda8879f1f0889b/tscancellation-fbeb639ede07d133c5f3.tmp* --globalPlugins typescript-styled-plugin --pluginProbeLocations /Users/user/.vscode/extensions/jpoissonnier.vscode-styled-components-1.7.0 --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc
user 31118 0.0 0.0 407973536 960 s000 R+ 1:25PM 0:00.00 grep 13314
ps aux | grep 13313
user 13313 43.3 1.8 447308560 297696 ?? S 10:35AM 4:03.42 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node --max-old-space-size=3072 /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js --serverMode partialSemantic --useInferredProjectPerProjectRoot --disableAutomaticTypingAcquisition --cancellationPipeName /var/folders/y0/x5lk6gms0k3115_pbkvw59n40000gn/T/vscode-typescript501/8cdb3bda8879f1f0889b/tscancellation-a39097a2837e5934d2e6.tmp* --globalPlugins typescript-styled-plugin --pluginProbeLocations /Users/user/.vscode/extensions/jpoissonnier.vscode-styled-components-1.7.0 --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc
user 31218 0.0 0.0 407962688 48 s000 S+ 1:25PM 0:00.00 grep 13313 Attached is a recording of the language server infinitely restarting from the status bar: I am using an M1 mac and have been experiencing this for more than a year. |
Just used the same guide as @ianbunag to identify the extension causing issues through the good old command line, appears to be the built-in TS server |
To investigate: Git commands (like checking diff) are causing ts server to rebuild files, maybe there is a chance of this being related to the cause of this issue |
Thanks for your comment @fenvalle - as a matter of fact, I just tried copying and pasting some non-dependent sections of my main problematic JS file into an empty new file in an empty workspace (no dir opened, or Git). Then I tried making simple edits (the likes of which would cause big CPU usage spikes in the actual file), and I did not note any major CPU usage (worked as you'd expect). Therefore, this could be related to Git potentially. Defo will further investigate. Edit (one of many): on further investigation, just tried another project of mine that is a Node module but has no Git repo. No difference, so maybe it isn't Git causing the issue. Perhaps it is due to the sheer amount of IntelliSense it wants to process, any ideas on how to improve the performance of this? |
@fenvalle @mjbvz @tamuratak: I've worked out the exact culprit for this, it is this setting for JavaScript (validation). Disabling it stopped the CPU spikes almost completely; now they are down to a much more expected level. While it isn't crucial to JS editing, this feature is nice to have on, so any ideas on why it could be causing these CPU spikes and potentially how to make it faster? Sorry to keep bothering you guys but this is something that is really bugging me - thank you so much for your assistance. |
Same issue here, since not too long ago I get annoying spikes (annoying because my PC fan goes high/low all the time). But I cannot find this "Javascript > Validate" setting. Where can we disable this exactly? |
@Sjoerd82 search for |
@
|
Hey @mjbvz, this issue might need further attention. @Viggo2, you can help us out by closing this issue if the problem no longer exists, or adding more information. |
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
Hi, this probably seems really basic but I've been having an issue with VSCode 1.75.0 on my M2 MacBook Air running the Apple silicon build on macOS 13.2. I work with React, and do not use the built-in terminal. Settings Sync is thankfully off.
Essentially, everything I do in the editor, things as basic as simply typing a character or commenting/uncommenting a line, cause CPU usage to spike and temperatures to rise. The consequence of this is that VSCode is always on the Using Significant Energy list, and my battery level drops much faster when editing code.
I have disabled all extensions (therefore running the app effectively vanilla, uninstalled and reinstalled VSCode, tried older versions, same issue. This is really annoying and significantly deteriorates battery life so help appreciated.
The text was updated successfully, but these errors were encountered: