High CPU load in VS Code

There can be several reasons why VS Code produces a high CPU load. In my case I experience this high CPU load on my MacBook since recent versions of VS Code. My MacBook is a heavy machine, but with 2 VS Code windows open I had 4 CPU's fully loaded +400% load!

The first thing you can do to find the cause of this issue is to take a look at the process explorer. If you find "Code Helper" using a lot of CPU you can take further action (1).

img.png

The next action to take is to investigate which sub-processes are draining your resources. This can be done by typing in the terminal: ps aux | grep [ProcessId]. The ProcessId or PID can be found in the Process Explorer (2).

In my case I got the following result:

1ton.snoei        45591 216.7  1.0 74163836 319112   ??  R    10:39AM   3:46.32 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node --inspect-port=0 /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork --type=extensionHost --skipWorkspaceStorageLock
2ton.snoei        47500   0.0  0.0 34130524    624 s005  S+   10:48AM   0:00.00 grep 45591

As you can see, the sub-process on the first line is eating almost all the CPU.

Further investigation, results in the findings on this page. This page contains heavily reported problems on CPU-usage cause by the Sync Settings extension.

The Settings Sync Extension provides synchronisation of settings and other stuff with GitHub Gist.

img_2.png

The solution is simple. Just disable it. And the problem is solved.

I am wondering if these guys realize how much unnecessary CO2 is spent by providing this CPU hungry solution? Which I don't even use!