VS Code takes 100% CPU usage even it is not open. I ran the ps aux | grep PID
command to check the details but can't understand anything. Here's the output:
tawhid 27099 100.0 0.1 447352160 11856 ?? R 7:18PM 151:14.95 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Renderer).app/Contents/MacOS/Code Helper (Renderer) --ms-enable-electron-run-as-node /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork --type=fileWatcher
tawhid 31889 0.0 0.0 408628368 1616 s000 S+ 10:28PM 0:00.00 grep 27099
Can anyone explain what process or extension uses so high CPU percentage? I have MacBook Air 2020. I have installed a lot of extensions out of curiosity.
Try to disabled "Settings Sync".
Seems to be a bug related to electron. Visual Studio Code (VS Code) was built using Electron. Electron is a framework that allows developers to build cross-platform desktop applications using web technologies like HTML, CSS, and JavaScript electron. When the VSCode is lazy, open your OS manager tool (activity monitor on MacOS or taskmgr on Windows). Find the Electron process, generally it's using too much CPU (40%-100%) when VSCode is lazy.
Here is this issue thread on github
Edited 7/1/2022: Another issue related to "Code Helper (Renderer)". Sometimes it's take a huge amount of CPU.
Go to settings –> followSymlinks and disable it. Or edit the settings.json and put:
search.followSymlinks: false
Another process that may use a lot of CPU is Google Chrome Helper (Renderer). This process is created when the VSCode javascript debugger is active. It's responsible to interact between the browser and the VSCode debugger. Here a link to help you diagnose it
Another relevant factor is audit performance. (Ctrl+Shift+P: windows or command+p: mac) then type: > and then type: performance.
Developer: Show Running Extensions: to get the basic stats about the running extensions and find out some possible issue. It sorts the extensions from longest to shortest activation time. The time is titled "Startup Activation" if the extension is loaded on startup.
Debug: Take Performance Profile: Then choose the process that you want to get the analyze report.
Debug: Startup Performance: Will show bunch of information on startup of vsCode.
In my case to get rid of all potentially problematic extensions I have removed vscode and all his extension/caches/etc and reinstalled, in mac this procedure can be done following this steps:
1st: remove vs from applications folder
rm -rf ~/Library/Preferences/com.microsoft.VSCode.helper.plist
rm -rf ~/Library/Preferences/com.microsoft.VSCode.plist
rm -rf ~/Library/Caches/com.microsoft.VSCode
rm -rf ~/Library/Caches/com.microsoft.VSCode.ShipIt/
rm -rf ~/Library/Application\ Support/Code/
rm -rf ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState/
rm -rf ~/.vscode*
Case all these steps have failed may you could try to downgrade VSCode to version 1.47 (in this version the current native debugger is not installed so all these involved processes aren't the same)