microsoft / vscode

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

High CPU usage while coding in python #58030

Closed jjaimon closed 5 years ago

jjaimon commented 6 years ago

Issue Type: Performance Issue

Code is consuming alarmingly high CPU when ever I code in python. I've been noticing this for the past 3 weeks. It was okay before that. I'm suspecting some extensions or configuration, but unable to figure out which one. I'm also wondering if the breadcrumbs feature is causing it as I see continuously moving line next out "Outline" view on the left panel as I type.

VS Code version: Code 1.27.0 (7b9afc4196bda60b0facdf62cfc02815509b23d6, 2018-09-05T05:22:06.672Z) OS version: Darwin x64 18.0.0

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz (8 x 2500)| |GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: unavailable_software
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled| |Load (avg)|3, 2, 2| |Memory (System)|16.00GB (1.36GB free)| |Process Argv|/Applications/Visual Studio Code.app/Contents/MacOS/Electron -psn_0_807109| |Screen Reader|no| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 16 131 28194 code main 0 49 28197 gpu-process 0 295 28198 window (kpd-webapps-monitor.py — git_wa) 0 164 28400 extensionHost 0 49 28409 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/json-language-features/server/dist/jsonServerMain --node-ipc --clientProcessId=28400 0 49 28410 electron_node server.js 0 147 28444 php /Users/jjaimon/.vscode/extensions/felixfbecker.php-intellisense-2.3.5/vendor/felixfbecker/language-server/bin/php-language-server.php --tcp=127.0.0.1:54696 --memory-limit=4095M 0 115 28752 /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python completion.py 0 33 28757 /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python jedi/evaluate/compiled/subprocess/__main__.py 0 16 28766 /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python jedi/evaluate/compiled/subprocess/__main__.py 0 49 28401 watcherService 0 49 28407 searchService 0 131 28402 shared-process 0 115 28902 window (Issue Reporter) 0 0 28905 /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= ```
Workspace Info ``` | Window (kpd-webapps-monitor.py — git_wa) | Folder (git_wa): 17615 files | File types: png(3095) jpg(1727) js(1652) css(1471) class(1352) | html(1185) xml(1153) jar(970) java(686) otf(680) | Conf files: package.json(6) launch.json(2) tasks.json(2) | settings.json(1) makefile(1) gulp.js(1) | Launch Configs: python(13) chrome pythonExperimental; ```
Extensions (36) Extension|Author (truncated)|Version ---|---|--- swagger-viewer|Arj|2.0.2 vscode-database|baj|1.5.2 haproxy|bma|0.1.1 imagepreview|buz|0.5.1 vscode-markdownlint|Dav|0.20.0 lua-debug|dev|1.1.0 githistory|don|0.4.2 xml|Dot|2.3.2 pgsql|dou|0.1.3 gitlens|eam|8.5.6 vscode-great-icons|emm|2.1.41 vsc-material-theme|Equ|2.4.2 php-intellisense|fel|2.3.5 vscode-firefox-debug|hbe|1.6.0 beautify|Hoo|1.4.2 svn-scm|joh|1.33.0 ldif|jta|0.1.1 php-cs-fixer|jun|0.1.85 vscode-gutter-preview|kis|0.13.1 python|ms-|2018.8.0 Go|ms-|0.6.89 debugger-for-chrome|msj|4.9.1 vscode-docker|Pet|0.1.0 material-icon-theme|PKi|3.5.3 psi-header|psi|1.5.0 quicktype|qui|12.0.40 nginx-formatter|ray|0.0.4 java|red|0.30.0 vscode-yaml|red|0.0.15 LiveServer|rit|5.1.1 bash-debug|rog|0.2.4 vscode-nginx|sha|0.5.0 vscode-java-debug|vsc|0.12.1 vscode-java-pack|vsc|0.3.0 vscode-java-test|vsc|0.8.0 vscode-maven|vsc|0.10.0 (5 theme extensions excluded)
mjbvz commented 6 years ago

When this problem occurs, in a command prompt try running code --status and share the output of this command. Alternatively, run ps aux | grep code to see which specific process has the high cpu usage

jjaimon commented 6 years ago
$ code --status                                                              
LSGetApplicationForInfo() failed with error -10814 while trying to determine the application with bundle identifier com.microsoft.VSCodeInsiders.

$ ps aux|grep code
user          75095   0.0  0.9  4530400 154992   ??  S     9:06PM   0:11.08 php /Users/user/.vscode/extensions/felixfbecker.php-intellisense-2.3.5/vendor/felixfbecker/language-server/bin/php-language-server.php --tcp=127.0.0.1:57883 --memory-limit=4095M
user          75064   0.0  0.3  5062872  51948   ??  S     9:06PM   0:01.24 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/user/.vscode/extensions/arjun.swagger-viewer-2.0.2/node_modules/vscode-languageclient/lib/utils/electronForkStart /Users/user/.vscode/extensions/arjun.swagger-viewer-2.0.2/out/language/server.js --node-ipc --clientProcessId=75053
jrieken commented 6 years ago

Hm, the process info doesn't seem to reveal much... Can you try to include more or try the code --status command again? Also, an update to 1.27.1 might help.

jjaimon commented 5 years ago

I've been using 1.27.1. BTW, I disabled the plugins reported earlier and see a difference with respect to CPU usage. I'll keep this issue under observation now.

jrieken commented 5 years ago

k - likely that this is an issue with python extension

vscodebot[bot] commented 5 years ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

dikaio commented 5 years ago

I'm also getting high CPU with the Microsoft Language Server for Python.

[~] code --status

Version:          Code 1.27.2 (f46c4c469d6e6d8c46f268d1553c5dc4b475840f, 2018-09-12T07:04:11.329Z)
OS Version:       Darwin x64 18.0.0
CPUs:             Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz (8 x 2900)
Memory (System):  16.00GB (0.38GB free)
Load (avg):       6, 4, 3
VM:               0%
Screen Reader:    no
Process Argv:     /Applications/Visual Studio Code.app/Contents/MacOS/Electron
GPU Status:       2d_canvas:                    enabled
                  checker_imaging:              disabled_off
                  flash_3d:                     enabled
                  flash_stage3d:                enabled
                  flash_stage3d_baseline:       enabled
                  gpu_compositing:              enabled
                  multiple_raster_threads:      enabled_on
                  native_gpu_memory_buffers:    enabled
                  rasterization:                enabled
                  video_decode:                 enabled
                  video_encode:                 enabled
                  webgl:                        enabled
                  webgl2:                       enabled

CPU %   Mem MB     PID  Process
    1       98   57370  code main
    3       82   57371     gpu-process
    4      279   57372     window (__init__.py — jet [Unsupported])
  107     2228   57377       extensionHost
    0       49   57402         /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/css-language-features/server/dist/cssServerMain --node-ipc --clientProcessId=57377
  269      983   57422         /Users/dad/.vscode/extensions/ms-python.python-2018.8.0/languageServer/Microsoft.Python.LanguageServer
    0       49   57379       watcherService
    0        0   57381       /usr/local/bin/zsh -l
    0        0   57840         bash /usr/local/bin/code --status
   11       49   57851           electron_node cli.js
    0       49   57388       searchService
    0       82   57403     shared-process
Workspace Stats:
|  Window (__init__.py — jet [Unsupported])
|    Folder (jet): 2865 files
|      File types: py(1118) pyc(1082) txt(403) rc(121) exe(10) json(9) rst(7)
|                  so(5) png(4) html(4)
|      Conf files: settings.json(1)
[~] ps aux | grep code
dad           57422 332.9 26.5 10903068 4453848   ??  R     7:43AM  25:18.34 /Users/dad/.vscode/extensions/ms-python.python-2018.8.0/languageServer/Microsoft.Python.LanguageServer
dad           54383   0.0  0.0  4378760   5560   ??  Ss    6:51AM   0:00.07 /System/Library/Frameworks/VideoToolbox.framework/Versions/A/XPCServices/VTDecoderXPCService.xpc/Contents/MacOS/VTDecoderXPCService
dad           41347   0.0  0.0  4378760   1076   ??  Ss    9:15PM   0:00.10 /System/Library/Frameworks/VideoToolbox.framework/Versions/A/XPCServices/VTDecoderXPCService.xpc/Contents/MacOS/VTDecoderXPCService
dad           17152   0.0  0.0  4401736    328   ??  Ss    3:08PM   0:00.26 /System/Library/PrivateFrameworks/IMTranscoding.framework/XPCServices/IMTranscoderAgent.xpc/Contents/MacOS/IMTranscoderAgent
dad            2769   0.0  0.0  4377988    348   ??  Ss    2:36PM   0:00.13 /System/Library/PrivateFrameworks/SafariShared.framework/Versions/A/XPCServices/com.apple.Safari.ImageDecoder.xpc/Contents/MacOS/com.apple.Safari.ImageDecoder
dad           58014   0.0  0.0  4277252    832 s001  S+    7:55AM   0:00.00 grep code

Following another vscode issue it was suggested to disable jedi which I've done. Also it was suggested that the linter could be the reason for the high cpu so I've tried pylint, pyflakes, and now on pep8. I have doubts about it being the linter.