microsoft / vscode

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

expensive cpu usage on start and hungry in memory #176775

Closed jozhuare99 closed 1 year ago

jozhuare99 commented 1 year ago

Type: Performance Issue

unlike other editor this one has a lot of features but the downside is very expensive usage of cpu on starting the app and when i save the changes on file the cpu is getting hungry again another one is the memory usage of this is very expensive, i think you need to build it from scratch again. you better build a new one using rust,

VS Code version: Code 1.76.1 (5e805b79fcb6ba4c2d23712967df89a089da575b, 2023-03-08T16:31:31.010Z) OS version: Linux x64 5.19.0-35-generic snap Modes: Sandboxed: Yes

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5 CPU M 560 @ 2.67GHz (4 x 2925)| |GPU Status|2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: disabled_off| |Load (avg)|3, 1, 1| |Memory (System)|5.66GB (3.14GB free)| |Process Argv|--no-sandbox --force-user-env --unity-launch --crash-reporter-id 50f5afdb-415e-4601-9e12-a5503fe32f67| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|ubuntu| |XDG_CURRENT_DESKTOP|Unity| |XDG_SESSION_DESKTOP|ubuntu| |XDG_SESSION_TYPE|wayland|
Process Info ``` CPU % Mem MB PID Process 0 139 14562 code main 0 41 14564 zygote 0 87 14713 gpu-process 0 41 14565 zygote 0 220 14651 window (header.jsx - shop - Visual Studio Code) 0 93 15267 issue-reporter 0 64 14618 utility-network-service 11 238 14947 utility-process 0 104 15008 electron-nodejs (/snap/code/121/usr/share/code/code --ms-enable-electron-run-as-node --max-old-space-size=3072 /home/ppp/.vscode/extensions/ms-vscode.vscode-typescript-next-5.1.20230309/node_modules/typescript/lib/tsserver.js --serverMode partialSemantic --useInferredProjectPerProjectRoot --disableAutomaticTypingAcquisition --cancellationPipeName /tmp/vscode-typescript1000/fe9088239bc1f97772e4/tscancellation-a8fd43bbc6e94bfeac26.tmp* --globalPlugins @vsintellicode/typescript-intellicode-plugin,ms-vsintellicode-typescript --pluginProbeLocations /home/ppp/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.30,/home/ppp/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.30 --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc) 0 290 15009 electron-nodejs (/snap/code/121/usr/share/code/code --ms-enable-electron-run-as-node --max-old-space-size=3072 /home/ppp/.vscode/extensions/ms-vscode.vscode-typescript-next-5.1.20230309/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /tmp/vscode-typescript1000/fe9088239bc1f97772e4/tscancellation-62d4812673310496bcad.tmp* --globalPlugins @vsintellicode/typescript-intellicode-plugin,ms-vsintellicode-typescript --pluginProbeLocations /home/ppp/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.30,/home/ppp/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.30 --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc) 0 93 15070 electron-nodejs (/snap/code/121/usr/share/code/code --ms-enable-electron-run-as-node /home/ppp/.vscode/extensions/ms-vscode.vscode-typescript-next-5.1.20230309/node_modules/typescript/lib/typingsInstaller.js --globalTypingsCacheLocation /home/ppp/.cache/typescript/5.1 --enableTelemetry --typesMapLocation /home/ppp/.vscode/extensions/ms-vscode.vscode-typescript-next-5.1.20230309/node_modules/typescript/lib/typesMap.json --validateDefaultNpmLocation) 0 75 15037 electron-nodejs (/snap/code/121/usr/share/code/code --ms-enable-electron-run-as-node /home/ppp/.vscode/extensions/sburg.vscode-javascript-booster-14.0.1/dist/server/server.js --node-ipc --clientProcessId=14947) 0 0 15038 electron-nodejs (reporter.js ) 0 58 15046 electron-nodejs (reporter.js ) 0 0 15098 electron-nodejs (reporter.js ) 0 41 15115 node /home/ppp/node/shop/node_modules/.bin/react-scripts test --testLocationInResults --json --useStderr --outputFile /tmp/jest_runner_shop_1000.json --watch --no-coverage --reporters default --reporters /home/ppp/.vscode/extensions/orta.vscode-jest-5.2.3/out/reporter.js --colors 0 93 15141 /home/ppp/.nvm/versions/node/v18.12.1/bin/node /home/ppp/node/shop/node_modules/react-scripts/scripts/test.js --testLocationInResults --json --useStderr --outputFile /tmp/jest_runner_shop_1000.json --watch --no-coverage --reporters default --reporters /home/ppp/.vscode/extensions/orta.vscode-jest-5.2.3/out/reporter.js --colors 0 93 15059 electron-nodejs (/snap/code/121/usr/share/code/code --ms-enable-electron-run-as-node /home/ppp/.vscode/extensions/visualstudioexptteam.intellicode-api-usage-examples-0.2.7/dist/server/server.js --node-ipc --clientProcessId=14947) 0 145 15327 electron-nodejs (/snap/code/121/usr/share/code/code --ms-enable-electron-run-as-node /home/ppp/.vscode/extensions/dbaeumer.vscode-eslint-2.4.0/server/out/eslintServer.js --node-ipc --clientProcessId=14947) 0 93 15335 electron-nodejs (/snap/code/121/usr/share/code/code --ms-enable-electron-run-as-node /home/ppp/.vscode/extensions/streetsidesoftware.code-spell-checker-2.19.0/packages/_server/dist/main.js --node-ipc --clientProcessId=14947) 0 64 15517 electron-nodejs (/snap/code/121/usr/share/code/code --ms-enable-electron-run-as-node /snap/code/121/usr/share/code/resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=14947) 0 127 14957 shared-process 0 70 14975 ptyHost 0 6 15281 /usr/bin/bash --init-file /snap/code/121/usr/share/code/resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh 0 70 14995 fileWatcher 0 0 15552 /bin/sh -c /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 0 0 15553 /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= ```
Workspace Info ``` | Window (header.jsx - shop - Visual Studio Code) | Folder (shop): 142 files | File types: scssc(86) js(7) json(4) scss(3) css(3) png(2) jsx(2) | gitignore(1) md(1) ico(1) | Conf files: settings.json(1) package.json(1); ```
Extensions (53) Extension|Author (truncated)|Version ---|---|--- node-js-snippet|abd|1.1.3 node-essentials|afr|1.1.0 vscode-icontheme-nomo-dark|be5|1.3.6 vscode-intelephense-client|bme|1.9.5 simple-react-snippets|bur|1.2.7 node-snippets|chr|1.3.3 npm-intellisense|chr|1.4.4 path-intellisense|chr|2.8.4 regex|chr|0.4.0 vscode-markdownlint|Dav|0.49.0 vscode-eslint|dba|2.4.0 githistory|don|0.6.20 gitlens|eam|13.3.2 vscode-html-css|ecm|1.13.1 EditorConfig|Edi|0.16.4 prettier-vscode|esb|9.10.4 auto-close-tag|for|0.5.14 vscode-pull-request-github|Git|0.60.0 rest-client|hum|0.25.1 RelativePath|jak|1.5.0 search-node-modules|jas|1.3.0 node-module-intellisense|lei|1.5.0 ReactFlowSnippets|lsa|0.2.17 vscode-language-babel|mgm|0.0.37 vscode-less|mrm|0.6.3 vscode-scss|mrm|0.10.0 vscode-kubernetes-tools|ms-|1.3.11 python|ms-|2023.4.1 js-debug-nightly|ms-|2023.3.817 makefile-tools|ms-|0.6.0 sublime-keybindings|ms-|4.0.10 vscode-typescript-next|ms-|5.1.20230309 vsliveshare|ms-|1.0.5834 vscode-jest|Ort|5.2.3 prettier-vscode-with-tabs|pas|1.1.0 vscode-versionlens|pfl|1.5.0 material-icon-theme|PKi|4.24.0 quicktype|qui|12.0.46 vscode-yaml|red|1.12.1 LiveServer|rit|5.7.9 vscode-sass-format|sas|1.1.7 vscode-javascript-booster|sbu|14.0.1 trailing-spaces|sha|0.4.1 js-jsx-snippets|sky|11.0.1 code-spell-checker|str|2.19.0 prettier-plus|svi|4.2.2 node-pack|Swe|0.1.16 sass-indented|syl|1.8.26 md-contents|the|1.2.3 intellicode-api-usage-examples|Vis|0.2.7 vscodeintellicode|Vis|1.2.30 JavaScriptSnippets|xab|1.8.0 html-css-class-completion|Zig|1.20.0
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscoreces:30445986 pythondataviewer:30285071 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593cf:30376535 pythonvs932:30410667 cppdebug:30492333 vscaat:30438848 vsclangdc:30486549 c4g48928:30535728 dsvsc012cf:30540253 pynewext54:30681850 azure-dev_surveyone:30548225 pyindex848:30662994 nodejswelcome1cf:30587006 282f8724:30602487 pyind779:30671433 f6dab269:30613381 pythonsymbol12:30671437 vsctsb:30677850 vscodeenable:30660116 funwalk2cf:30682975 ```
gjsjohnmurray commented 1 year ago

You can use the Start Extension Bisect command to investigate whether any of your extensions is particularly resource-hungry.

jozhuare99 commented 1 year ago

i disabled all of the extension and i will test it again.

Screenshot from 2023-03-11 08-15-42

all the extension are disabled this is when i snapshot of starting the vscode

Screenshot from 2023-03-11 08-19-57

this one is the snapshot when i typing and and changing some code

the memory usage are drop but it has a lot of cpu process all extension are disabled

then i tried to disable the internet connection

still no improvement on cpu process every letter that i type it compute very hard on cpu

why other editor like sublime and atom has nothing like this?

amazingrv commented 1 year ago

Not sure but it has something to do with filewatch changes in tsserver 4.9+ Please add this to you settings json object and restart to see if that works

"typescript.tsserver.watchOptions": {
    "watchDirectory": "dynamicPriorityPolling",
    "watchFile": "dynamicPriorityPolling"
  }
jozhuare99 commented 1 year ago

not work ive uninstalled all extension and does some disabling some auto update and features and ive done to put that setting json code you provided but it still has no improvement maybe because its built in electron ? or its just the vs code way record every codes that coder inputted in the file. im either choose between sublime, atom and notepad++

amazingrv commented 1 year ago

Please share your workspace settings.json here

jozhuare99 commented 1 year ago

I actually use the vscode refined version but still had no changes on cpu are still oveloading on start and hungry on every type i made or changes it seems thats the way it is and i cannot do anything about it so this issue is closed.