shanalikhan / code-settings-sync

🌴💪 Synchronize your Visual Studio Code Settings Across Multiple Machines using GitHub GIST 💪🌴
https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync
MIT License
4.02k stars 390 forks source link

High extenstionHost CPU usage when Settings Sync is enabled #1361

Open larshei opened 2 years ago

larshei commented 2 years ago

Issue Type: Performance Issue

My Macbook got very hot and drained its battery within about 1 hour with 6..8 VSCode windows opened (with each window being placed on a separate desktop).

For each window, there was a "Code Helper" process that consumed about 30..40% CPU constantly, no matter if the winwods were in focus or not. Using ps aux and the PID taken from the Activity Monitor, it turned out the extensionHost seems to cause the high CPU usage.

Following some info from the web, I did an extension bisect with one instance/window of VSCode opened and used ps -eo pcpu,pid,command | grep Code | grep extensionHost in order to check CPU consumption on the extension host, setting the result to "good" or "bad" depending on wether the CPU usage stayed above 30% or not.

The extension bisection identified Settings Sync as the "faulty" plugin. After disabling, even when opening multiple windows, only the currently focused window had any relevant CPU usage, most other processes stayed in the <1% range.

Extension version: 3.4.3 VS Code version: Code 1.68.1 (30d9c6cd9483b2cc586687151bcbcd635f373630, 2022-06-14T12:52:13.188Z) OS version: Darwin x64 21.5.0 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled| |Load (avg)|2, 4, 7| |Memory (System)|16.00GB (0.47GB free)| |Process Argv|--crash-reporter-id 6df23f80-4b47-430d-9220-cd92baff39d1| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstes627:30244334 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonvspyt551cf:30345471 pythonptprofiler:30281270 vsdfh931:30280409 vshan820:30294714 vstes263cf:30335440 pythondataviewer:30285071 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 vsc1dst:30438360 pythonvs932:30410667 wslgetstarted:30449410 vscscmwlcmt:30465135 cppdebug:30492333 vsclangdf:30486550 ```
noxasch commented 2 years ago

I think this is related to #1348 as well since the extension try to monitor all the file instead of focusing on the settings.

milesrichardson commented 2 years ago

I noticed the same problem of high cpu usage in code helper today. Uninstalling this extension solved the problem.

In fact I did not even realize I had this extension installed. I assumed the settings sync was an official VSCode extension, which I guess it is – I think what happened is the official extension replaced this one, and they share the same name, so I didn't notice that some feature contributions were coming from this one and others from VSCode.

This one hasn't been updated in 3 years, and the VSCode settings sync works fine, so I don't see any reason to even worry about fixing it.

loehx commented 2 years ago

+1

lincolnthree commented 2 years ago

Also reproduced here. Using VSCode builtin sync until this is fixed. Love this plugin! Thanks for all your work on this.

vesper8 commented 2 years ago

Unfortunately this extension hasn't been updated in nearly 4 years and I doubt @shanalikhan will fix it now, specially since there's a built-in alternative available. I also have loved this extension but will have to try out the alternative now. I guess it's not so easy to fork a vscode extension and point vscode to use your own fork? or else someone could "easily" just disable the "file watching" part of the code.. no idea what that was even ever put in exactly.

This extension has basically been driving me nuts for over a year (or more) with constant battery drain. Hell this extension probably caused a 100+ battery cycles to deplete just because I never until now had the will to turn off all my extensions one by one and finally find out wtf is causing all the battery drainage... oh well... at least from now on my laptop won't burn a hole in my lap anymore ;p

On my 16in M1 Max.. with this extension turned on Code Helper takes 150% CPU for every vscode instance (including completely IDLE ones!!!).. and I often have 2+ of these opened. Without this extension, it takes 0% when IDLE! =/

alex-kinokon commented 1 year ago

I spent some time debugging this and found out the culprit is vscode-chokidar. I replaced it with the regular chokidar, rebuilt the extension and my CPU usage went back to normal.

lastnigtic commented 1 year ago

same issue

farzd commented 1 year ago

absolute insanity, been suffering from over heating and bad battery life on my fullspeced M1 mbp 14, 100% cpu usage when running this extension, now down to single digits

absolute shame, this has caused me a lot of grief and over what? syncing settings :/

dghez commented 1 year ago

22.05.2023, had the same issue, my activity monitor had like 6 tasks called code-insider helper (plugin) with CPU around 100% all. Disabled and uninstalled the extension (since it's now implemented in vscode) and so far everything looks back to normal

goharShoukat commented 1 year ago

I turned the sync off but my VS Code helper plugin is still going at 100.2% every time I launch an application!

Screenshot 2023-08-30 at 12 09 04
alex-kinokon commented 1 year ago

@goharShoukat You should uninstall the extension. I sent in a PR to fix it a long time ago and the owner just does't bother to upload a new version despite multiple requests.

dreit-p commented 8 months ago

The problem still exists :( UPD: I found sync disabled but signed it. I activated it again and vscode notified me about a conflict, I solved it and now it works fine. I don't know what has happened.