microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.65k stars 28.68k forks source link

When I interact with the visual studio code MY CPU almost runs at 100% #215502

Closed iddhi-sulakshana closed 3 months ago

iddhi-sulakshana commented 3 months ago

Type: Performance Issue

Open the VS Code and interact with the files

VS Code version: Code 1.90.1 (611f9bfce64f25108829dd295f54a6894e87339d, 2024-06-11T21:02:43.666Z) OS version: Linux x64 6.8.0-35-generic snap Modes:

System Info |Item|Value| |---|---| |CPUs|11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz (8 x 1499)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|3, 3, 2| |Memory (System)|7.50GB (2.11GB free)| |Process Argv|--force-user-env --no-sandbox --use-gl=angle --use-angle=swiftshader --crash-reporter-id d699359d-3cdf-49c3-8b60-51ef5dd002f4| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|ubuntu| |XDG_CURRENT_DESKTOP|Unity| |XDG_SESSION_DESKTOP|ubuntu| |XDG_SESSION_TYPE|x11|
Process Info ``` CPU % Mem MB PID Process 0 177 13598 code main 0 38 13600 zygote 0 46 13601 zygote 1 261 13697 window [1] (home.dart - bike_rent_mobile - Visual Studio Code) 0 100 16806 window [2] (Issue Reporter) 0 61 13636 utility-network-service 0 84 13751 ptyHost 0 8 13814 /usr/bin/zsh -i 0 376 13761 extensionHost [1] 0 69 13904 /home/iddhi/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/dart tooling-daemon --machine 0 77 13908 electron-nodejs (config.js ) 0 445 13913 /home/iddhi/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.90.0 0 61 13970 /home/iddhi/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/dart devtools --machine --allow-embedding --dtd-uri ws://127.0.0.1:33821/KM7YCUwbt6obuQ9e 0 77 14153 /snap/code/161/usr/share/code/code /snap/code/161/usr/share/code/resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=13761 0 115 13776 shared-process 0 0 16845 /bin/sh -c /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 0 0 16851 /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 0 84 13778 fileWatcher [1] ```
Workspace Info ``` | Window (home.dart - bike_rent_mobile - Visual Studio Code) | Folder (bike_rent_mobile): 1230 files | File types: json(117) xml(117) flat(95) len(32) jar(28) class(24) | png(23) bin(22) txt(13) tab(12) | Conf files:; ```
Extensions (23) Extension|Author (truncated)|Version ---|---|--- simple-react-snippets|bur|1.2.8 dart-code|Dar|3.90.0 flutter|Dar|3.90.0 es7-react-js-snippets|dsz|4.4.3 vscode-html-css|ecm|2.0.10 react-native-react-redux|EQu|2.0.6 prettier-vscode|esb|10.4.0 copilot|Git|1.202.932 copilot-chat|Git|0.16.1 vscode-docker|ms-|1.29.1 debugpy|ms-|2024.6.0 python|ms-|2024.8.1 vscode-pylance|ms-|2024.6.1 jupyter|ms-|2024.5.0 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.18 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-slideshow|ms-|0.1.6 vscode-react-native|msj|1.13.0 material-icon-theme|PKi|5.4.2 code-snapshot|rob|0.2.1 ayu|tea|1.0.5 vscode-todo-highlight|way|1.0.5 (1 theme extensions excluded)
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscoreces:30445986 vscod805:30301674 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 jchc7451:31067544 chatpanelc:31048052 dsvsc021:30996838 0ee40948:31013168 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 pythonprt:31056678 dwnewjupyter:31046869 newcmakeconfigv2:31071590 ```
radeanu commented 3 months ago

Same issue, VS Code was installed as a Snap package. I solved it by reinstalling as shown here

shelvesdragon commented 3 months ago

This is likely caused by the fix/workaround for snap included in version 1.90.1, which was addressing the crashes in 1.90.0 by using the software emulated OpenGL backend rather than GPU hardware acceleration. That puts everything in CPU. The workaround for snap for now is to revert to version 1.89/snap revision 159 or indeed to switch to the debian package.

Please revert to v1.89 or use debian package till this issue is fixed. https://github.com/microsoft/vscode/issues/212494#issuecomment-2166941209

Revert snap:

sudo snap revert code --revision 159

Edit: If revision 159 is not in your snap revision history any more and you get the error: error: cannot revert "code": cannot find revision 159 for snap "code", you can remove and reinstall VSCode with:

sudo snap remove code

And reinstall revision 159 with:

sudo snap install code --revision 159 --classic

Note: This will keep revision 159 only until the next release and will not remove user data, i. e. opened workspace, extensions etc. End of Edit

How to switch to the debian package properly, including signature checks is mentioned in the link provided by @radeanu

deepak1556 commented 3 months ago

Merging to https://github.com/microsoft/vscode/issues/212494, please follow the issue for updates.

Thanks @shelvesdragon for linking to the workarounds.