Skip to content

1.65.0 Consuming a lot of CPU...code navigation is slow #48517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
skhilliard opened this issue Mar 4, 2022 · 23 comments
Closed

1.65.0 Consuming a lot of CPU...code navigation is slow #48517

skhilliard opened this issue Mar 4, 2022 · 23 comments
Assignees
Labels
Needs Investigation This issue needs a team member to investigate its status.

Comments

@skhilliard
Copy link

Issue Type: Bug

After updating to the latest release of VS Code (1.65.0), it has starting consuming a lot more CPU and memory....code navigation is unusable. Any insights as to why this is happening?

VS Code version: Code 1.65.0 (b5205cc8eb4fbaa726835538cd82372cc0222d43, 2022-03-02T11:12:08.962Z)
OS version: Windows_NT x64 10.0.19044
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz (12 x 2904)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.74GB (18.62GB free)
Process Argv --crash-reporter-id a33ec631-4700-4009-b1a5-ec7d22d15b65
Screen Reader no
VM 0%
Extensions (20)
Extension Author (truncated) Version
nugetpackagemanagergui ali 1.1.9
vscode-eslint dba 2.2.2
xml Dot 2.5.1
gitlens eam 12.0.1
prettier-vscode esb 9.3.0
gitkraken-authentication git 1.0.3
vscode-nuget-package-manager jmr 1.1.6
vscode-azurefunctions ms- 1.6.0
vscode-azureresourcegroups ms- 0.4.0
vscode-cosmosdb ms- 0.18.1
vscode-docker ms- 1.20.0
csharp ms- 1.24.1
remote-containers ms- 0.224.2
remote-wsl ms- 0.64.2
azure-account ms- 0.10.0
azurecli ms- 0.5.0
powershell ms- 2021.12.0
vscode-typescript-tslint-plugin ms- 1.3.3
debugger-for-chrome msj 4.13.0
language-stylus sys 1.15.0
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30443607
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30433507
vsclayoutctrc:30437038
vsrem710:30416614
dsvsc009:30440023
pythonvsnew555:30442236
vsbas813:30436447
vscscmwlcmt:30438805
vscgsvid1:30447480
helix:30440343

@mjbvz
Copy link
Contributor

mjbvz commented Mar 4, 2022

Please follow these instructions to collect performance information. Share the output of code-insiders --status

@mjbvz mjbvz added the Needs More Info The issue still hasn't been fully clarified label Mar 4, 2022
@skhilliard
Copy link
Author

skhilliard commented Mar 4, 2022

Here is the output of code --status:

Version:          Code 1.65.0 (b5205cc8eb4fbaa726835538cd82372cc0222d43, 2022-03-02T11:12:08.962Z)
OS Version:       Windows_NT x64 10.0.19044
CPUs:             Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz (12 x 2904)
Memory (System):  31.74GB (19.87GB free)
VM:               0%
Screen Reader:    no
Process Argv:     --crash-reporter-id a33ec631-4700-4009-b1a5-ec7d22d15b65
GPU Status:       2d_canvas:                  enabled
                  gpu_compositing:            enabled
                  multiple_raster_threads:    enabled_on
                  oop_rasterization:          enabled
                  opengl:                     enabled_on
                  rasterization:              enabled
PS C:\Code\Newton\EVolvED\source\service> code --status

Version:          Code 1.65.0 (b5205cc8eb4fbaa726835538cd82372cc0222d43, 2022-03-02T11:12:08.962Z)
OS Version:       Windows_NT x64 10.0.19044
CPUs:             Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz (12 x 2904)
Memory (System):  31.74GB (19.57GB free)
VM:               0%
Screen Reader:    no
Process Argv:     --crash-reporter-id a33ec631-4700-4009-b1a5-ec7d22d15b65
GPU Status:       2d_canvas:                  enabled
                  gpu_compositing:            enabled
                  multiple_raster_threads:    enabled_on
                  oop_rasterization:          enabled
                  opengl:                     enabled_on
                  rasterization:              enabled
                  skia_renderer:              enabled_on
                  video_decode:               enabled
                  vulkan:                     disabled_off
                  webgl:                      enabled
                  webgl2:                     enabled

CPU %   Mem MB     PID  Process
    0       99   15252  code main
    0      107   15044     shared-process
    0       82    3504       fileWatcher
    0       91   18024       ptyHost
    0        6    2052         console-window-host (Windows internal process)
    0       91   16304         C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
    0       16   10492           C:\WINDOWS\system32\cmd.exe /c ""C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --status"
    0       84    2288             "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\bin\..\Code.exe"  "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\bin\..\resources\app\out\cli.js" --ms-enable-electron-run-as-node --status
    6      115    4924               "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\Code.exe" --status
    0       74    4544                 crashpad-handler
    0      169   15944     extensionHost
    0       80    8996       "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node "c:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=15944
    8     1123   12724       "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node --max-old-space-size=3072 "c:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js" --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName C:\Users\KELLYH~1\AppData\Local\Temp\vscode-typescript\7a5c88b33ad1682e6614\tscancellation-b3185407371594c92e38.tmp* --globalPlugins typescript-tslint-plugin --pluginProbeLocations c:\Users\KellyHilliard\.vscode\extensions\ms-vscode.vscode-typescript-tslint-plugin-1.3.3 --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc
    0       97   13236         "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node "c:/Users/KellyHilliard/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/node_modules/typescript/lib/typingsInstaller.js" --globalTypingsCacheLocation C:/Users/KellyHilliard/AppData/Local/Microsoft/TypeScript/4.6 --enableTelemetry --typesMapLocation "c:/Users/KellyHilliard/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/node_modules/typescript/lib/typesMap.json" --validateDefaultNpmLocation
    0      362   16084       "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node c:\Users\KellyHilliard\.vscode\extensions\dbaeumer.vscode-eslint-2.2.2\server\out\eslintServer.js --node-ipc --clientProcessId=15944
    0      127   16856       "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node --max-old-space-size=3072 "c:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js" --serverMode partialSemantic --useInferredProjectPerProjectRoot --disableAutomaticTypingAcquisition --cancellationPipeName C:\Users\KELLYH~1\AppData\Local\Temp\vscode-typescript\7a5c88b33ad1682e6614\tscancellation-30ff4f1db65b753a2316.tmp* --globalPlugins typescript-tslint-plugin --pluginProbeLocations 
c:\Users\KellyHilliard\.vscode\extensions\ms-vscode.vscode-typescript-tslint-plugin-1.3.3 --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc
    0       54   17012     utility-network-service
    0      192   17024     gpu-process
    0       34   17892     crashpad-handler
    0      226   18228     window (hl7Import.ts - service - Visual Studio Code)

Workspace Stats:
|  Window (hl7Import.ts - service - Visual Studio Code)
|    Folder (service): 3032 files
|      File types: ts(815) html(389) jade(386) styl(371) js(369) bcmap(168)
|                  json(131) png(48) ttf(23) log(20)
|      Conf files: tsconfig.json(5) package.json(2) dockerfile(2)
|                  launch.json(1) settings.json(1) tasks.json(1) gulp.js(1)
|                  webpack.config.js(1)
|      Launch Configs: node(8)

@mjbvz
Copy link
Contributor

mjbvz commented Mar 4, 2022

Unfortunately that doesn't show anything using a lot of cpu

What language are you working in? Does this reproduce in the latest VS Code insiders build with all extensions disabled?

@pouriamoosavi
Copy link

pouriamoosavi commented Mar 5, 2022

I am using nodejs/express and no extension is enable except Visual Studio IntelliCode. And I have the same problem. I have problem with ctrl + space and autocomplete as well. It takes a long time to open the popup

@skhilliard
Copy link
Author

skhilliard commented Mar 7, 2022

@mjbvz I will give that a try....I am working in Typescript. I do notice that it really seems to kick in as soon as I open up a TypeScript file in the editor. With my current version, I did disable all extensions, but the problem still persists. Here is another code --status capture...

Version:          Code 1.65.0 (b5205cc8eb4fbaa726835538cd82372cc0222d43, 2022-03-02T11:12:08.962Z)
OS Version:       Windows_NT x64 10.0.19044
CPUs:             Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz (12 x 2904)
Memory (System):  31.74GB (21.55GB free)
VM:               0%
Screen Reader:    no
Process Argv:     --crash-reporter-id a33ec631-4700-4009-b1a5-ec7d22d15b65
GPU Status:       2d_canvas:                  enabled
                  gpu_compositing:            enabled
                  multiple_raster_threads:    enabled_on
                  oop_rasterization:          enabled
                  opengl:                     enabled_on
                  rasterization:              enabled
                  skia_renderer:              enabled_on
                  video_decode:               enabled
                  vulkan:                     disabled_off
                  webgl:                      enabled
                  webgl2:                     enabled

CPU %   Mem MB     PID  Process
    0      103   14504  code main
    0       54    6048     utility-network-service
    0       34   10660     crashpad-handler
    0      110   11692     shared-process
    0       82   10008       fileWatcher
    0       90   19712       ptyHost
    0        6    5884         console-window-host (Windows internal process)
    0       89   20324         C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
    0       16   19124           C:\WINDOWS\system32\cmd.exe /c ""C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --status"
    0       84   15088             "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\bin\..\Code.exe"  "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\bin\..\resources\app\out\cli.js" --ms-enable-electron-run-as-node --status
    6      115   12552               "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\Code.exe" --status
    0       74   17460                 crashpad-handler
    0      224   13332     window (hl7Import.ts - service - Visual Studio Code)
    0      214   17484     gpu-process
    0      113   19080     extensionHost
    9      661     940       "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node --max-old-space-size=3072 "c:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js" --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName C:\Users\KELLYH~1\AppData\Local\Temp\vscode-typescript\ba921916edda07f199a8\tscancellation-65ff6ae321c13ae0cbea.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc
    0       97   18560         "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node "c:/Users/KellyHilliard/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/node_modules/typescript/lib/typingsInstaller.js" --globalTypingsCacheLocation C:/Users/KellyHilliard/AppData/Local/Microsoft/TypeScript/4.6 --enableTelemetry --typesMapLocation "c:/Users/KellyHilliard/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/node_modules/typescript/lib/typesMap.json" --validateDefaultNpmLocation
    0       80    3632       "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node "c:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=19080
    0      123   19064       "C:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node --max-old-space-size=3072 "c:\Users\KellyHilliard\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js" --serverMode partialSemantic --useInferredProjectPerProjectRoot --disableAutomaticTypingAcquisition --cancellationPipeName C:\Users\KELLYH~1\AppData\Local\Temp\vscode-typescript\ba921916edda07f199a8\tscancellation-9341c52c98dd15f04677.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc

Workspace Stats:
|  Window (hl7Import.ts - service - Visual Studio Code)
|    Folder (service): 3032 files
|      File types: ts(815) html(389) jade(386) styl(371) js(369) bcmap(168)
|                  json(131) png(48) ttf(23) log(20)
|      Conf files: tsconfig.json(5) package.json(2) dockerfile(2)
|                  launch.json(1) settings.json(1) tasks.json(1) gulp.js(1)
|                  webpack.config.js(1)
|      Launch Configs: node(8)

Task manager shows a very large amount of memory usage....CPU usage fluctuates between ~15 to 25%....

image

In this state, using code navigation tools, intellisense, etc. are basically unusable.

@skhilliard
Copy link
Author

@mjbvz Sorry for flooding this thread....I just installed the insider version....no extensions. It behaves the same way.

Version: 1.66.0-insider (user setup)
Commit: e80a0ca
Date: 2022-03-07T05:16:48.804Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19044

After I open a TypeScript file, it starts consuming quite a lot CPU and memory...I tried doing code-insiders --status it doesn't work....

PS C:\Code\Newton\EVolvED\source\service> code-insiders --status
code-insiders : The term 'code-insiders' is not recognized as the name of a cmdlet, function,    ipt file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
script file, or operable program. Check the spelling of the name, or if a path was included,    
verify that the path is correct and try again.
At line:1 char:1
+ code-insiders --status
+ ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (code-insiders:String) [], CommandNotFoundExcepti 
   on
    + FullyQualifiedErrorId : CommandNotFoundException

@skhilliard
Copy link
Author

Just FYI....I downgraded back to the January version:

Version: 1.64.2 (user setup)
Commit: f80445acd5a3dadef24aa209168452a3d97cc326
Date: 2022-02-09T22:02:28.252Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19044

...the problem goes away there. So it really seems like something introduced in 1.65.

@mjbvz
Copy link
Contributor

mjbvz commented Mar 9, 2022

@skhilliard Can you share a project that causes this issue so we can investigate?

@skhilliard
Copy link
Author

skhilliard commented Mar 11, 2022

@mjbvz I tried creating a small project to reproduce but didn't have any luck. This currently is happening with our project which is quite large...and for obvious reasons, I can't put our company's code base up here....what else can I provide to help you?

@mjbvz
Copy link
Contributor

mjbvz commented Mar 11, 2022

Try putting together a minimal project that demonstrates the problem so we can investigate on our machines

Alternatively, you can also try collecting the TypeScript server log. However this may include source code that you either need to scrub or share the log with us privately:

  1. Set "typescript.tsserver.log": "verbose",
  2. Restart VS Code and reproduce the problem
  3. In VS Code, run the TypeScript: Open TS Server log command
  4. This should open a large log file called tsserver.log

⚠️Warning: The TypeScript log may include information from your workspace, including file paths and source code. If you have any concerns about posting this publicly on Github, just let me know and we can arrange something else. On our side, we only use these logs to investigate issues like this

@skhilliard
Copy link
Author

@mjbvz I will gather the Typescript server log for you.....how can I share this with you at Microsoft privately?

Thanks,
Kelly

@skhilliard
Copy link
Author

@mjbvz I have some logs ready for you if you can supply the means by which to get them to you.

Thanks,
Kelly

@mjbvz
Copy link
Contributor

mjbvz commented Mar 15, 2022

Great! You can email the logs to matb AT microsoft . com

@nati-maskens
Copy link

Maybe related: microsoft/vscode#145309

@skhilliard
Copy link
Author

@mjbvz Did you have a chance to review the Typescript logs I email to you?

Thanks!

@mjbvz
Copy link
Contributor

mjbvz commented Mar 24, 2022

@skhilliard Yes thanks, I've forward them along to the TS team as I didn't see anything that stood out to me. Hopefully they will identify what is going on

@skhilliard
Copy link
Author

Has there been any feedback from the TS team regarding this?

@mjbvz mjbvz reopened this Apr 1, 2022
@mjbvz mjbvz transferred this issue from microsoft/vscode Apr 1, 2022
@mjbvz mjbvz removed their assignment Apr 1, 2022
@RyanCavanaugh RyanCavanaugh removed the Needs More Info The issue still hasn't been fully clarified label Apr 4, 2022
@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Apr 4, 2022
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.7.1 milestone Apr 4, 2022
@andrewbranch
Copy link
Member

@skhilliard sorry for the delay. From your log I can see you have a dependency (direct or indirect) on mongoose, which has gotten a lot of complaints about the performance of their typings:

The recent comments match the timing of when you noticed a slowdown:

VSCode February 2022 (TS >4.6) has terrible performance, where as VSCode January 2022 (TS <4.6) shows no regression.

You could follow the instructions on generating a performance trace and send us that if you’re interested, but I suspect it will show a lot of time being taken up on mongoose.

I’m interested in seeing if the new variance annotations being introduced in TypeScript 4.7 would help mongoose typings—I’ll plan to investigate a bit during the next release.

@DanielRosenwasser DanielRosenwasser removed this from the TypeScript 4.7.1 milestone May 13, 2022
@JustFly1984
Copy link

this could be related to incomplete tsconfig setup, or eslintrc. You need to add node_modules, and build artifacts into exclude sections of tsconfig, and eslintrc files. This way it will stop looking there, hence reduce the load on CPU.

@skhilliard
Copy link
Author

this could be related to incomplete tsconfig setup, or eslintrc. You need to add node_modules, and build artifacts into exclude sections of tsconfig, and eslintrc files. This way it will stop looking there, hence reduce the load on CPU.

Thanks for the suggestion, but I don't think that is the case. Here are the contents of my tsconfi.json file:

{
  "compileOnSave": true,
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "removeComments": true,
    "noImplicitAny": false,
    "skipLibCheck": true,
    "allowUnusedLabels": false,
    "noImplicitReturns": true,
    "alwaysStrict": true,
    "typeRoots": [
      "./node_modules/@types/"
    ]
  },
  "include": [
    "**/*.ts",
    "**/*.js"
  ],
  "exclude": [
    "app",
    "node_modules",
    "**/*.spec.ts",
    "smarttest",
    "fhirtest",  
    "build"
  ]
}

@andrewbranch
Copy link
Member

@skhilliard the mongoose maintainers have said they believe the issue is fixed in mongoose v6. Are you able to try that? (I have no idea how difficult the upgrade is.)

@andrewbranch
Copy link
Member

The mongoose maintainers have identified some recent regressions and have a proposed fix up; see Automattic/mongoose#12284. I don’t think there’s anything specific to do on our side so I’m going to go ahead and close this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

No branches or pull requests

9 participants