Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code using large amounts of CPU

I'm running Windows 10. VSCode, even when idle, takes up a consistent 26-30% of my cpu. I tried code --disable-extensions in CMD to check if an extension was causing the problem, but my performance was the same as with extensions.

When I used sublime text, I had a similar issue with the editor using large amounts of cpu on idle - the problem was with indexing, which could be turned off with a single line of code in the settings. I tried looking up indexing on VSCode, but I couldn't find anything pertaining to my issue. What could be the problem?

like image 715
agreis1 Avatar asked Aug 16 '18 22:08

agreis1


3 Answers

For me the solution was disable extension auto updates and some extra settings for the search engine. The most efficient one was search.followSymlinks": false. I share my settings.json file.

"files.exclude": {
        "**/tmp/**": true,
        "**/node_modules/**": true,
        "**/.git/objects/**": true,
},
"files.watcherExclude": {
        "**/.git/objects/**": true,
        "**/.git/subtree-cache/**": true,
        "**/node_modules/**": true,
        "**/tmp/**": true,
        "**/dist/**": true
},
"search.exclude": {
        "**/node_modules/**": true,
        "**/dist/**": true,
        "**/tmp/**": true,
        "**/.git/objects/**": true,
        "**/.git/subtree-cache/**": true
},
"extensions.autoCheckUpdates": false,
"extensions.autoUpdate": false,
"search.followSymlinks": false
like image 120
Diego Méndez Avatar answered Jan 02 '23 20:01

Diego Méndez


VS code uses the file watcher to identify any changes in the files. You can exclude the folders containing multiple files and not require to watch continuously.

"files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/node_modules/**": true
}
like image 38
Bilash Avatar answered Jan 02 '23 20:01

Bilash


For me what solved the problem was turning off Auto Import extension, was working on a huge project, and only once I opened that project the VS Code started eating up my CPU, in the left bottom corner it said Scanning... I right clicked on it, and "manage extensions" appeared I clicked on it and immediately went to Auto Import extension, I turned it off and everything was back to normal. So point being try checking bottom left corner for some processes and try disabling those process and hopefully it works, or for at least some of you.

[EDIT] What you could also do is open Task Manager and you would see something like \> Visual Studio Code (8) I would click on the arrow to see the list of all VS Code processes and kill only those (in my case only one) that was/were making all the problems

like image 29
high incompetance Avatar answered Jan 02 '23 21:01

high incompetance