microsoft / vscode

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

High CPU usage #74992

Closed anayak-alphasense closed 5 years ago

anayak-alphasense commented 5 years ago

VS code is using very high CPU. Issue Type: Performance Issue

Why VS code is using very high CPU Usage.

VS Code version: Code 1.34.0 (a622c65b2c713c890fcf4fbf07cf34049d5fe758, 2019-05-15T21:59:37.030Z) OS version: Windows_NT x64 10.0.16299

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz (4 x 2594)| |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: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.89GB (7.69GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 10 74 13196 code main 1 68 4524 window (Issue Reporter) 0 55 12100 shared-process 0 456 12568 gpu-process 0 255 12632 window (RSSFilterContent.tsx - frontend - Visual Studio Code) 0 47 10524 searchService 0 13 10904 watcherService 0 5 10928 console-window-host (Windows internal process) 0 124 11672 extensionHost 0 1378 11888 electron_node tsserver.js 0 19 7668 electron_node typingsInstaller.js typesMap.js 0 22 13680 "C:\Program Files\Microsoft VS Code\Code.exe" "c:\Program Files\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain" --node-ipc --clientProcessId=11672 0 11 13192 electron-crash-reporter 0 8 13664 winpty-process 0 9 13724 console-window-host (Windows internal process) 0 4 13776 C:\Windows\System32\cmd.exe 0 35 6864 "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\\node_modules\npm\bin\npm-cli.js" run build-dev 0 4 1844 electron_node config.js config.js 0 417 2564 node "C:\Users\AshishNa\Documents\AlphaSense\frontend\node_modules\.bin\\..\webpack\bin\webpack.js" --colors --config w/devapp.config.js 37 694 13720 "C:\Program Files\nodejs\node.exe" --max-old-space-size=2048 C:\Users\AshishNa\Documents\AlphaSense\frontend\node_modules\fork-ts-checker-webpack-plugin\lib\service.js ```
Workspace Info ``` | Window (RSSFilterContent.tsx - frontend - Visual Studio Code) | Folder (frontend): 3120 files | File types: svg(1014) ts(815) tsx(545) png(309) scss(172) js(41) | woff(32) woff2(28) gif(25) psd(21) | Conf files: tslint.json(3) package.json(2) tsconfig.json(1) gulp.js(1); ```

Extensions: none

vscodebot[bot] commented 5 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

egamma commented 5 years ago

Can you reproduce this in version 1.35?

anayak-alphasense commented 5 years ago

@egamma No I haven't tried in 1.35 But its using very high CPU in 1.34. So do you want me to update it to 1.35 ?

hanneswidrig commented 5 years ago

@anayak-alphasense Performance issues got significantly better with the upgrade to TypeScript 3.5.x. VSCode's performance has improved immensely with the latest stable release.

egamma commented 5 years ago

@anayak-alphasense yes please update to 1.35 and report back whether you still see the same performance issue.

wclr commented 5 years ago

I'm using the latest insiders 1.35, i'm actually quite tired of this problem. Maybe we are writing too complex TS code, that tsserver just can handle it appropriately? -)

egamma commented 5 years ago

@whitecolor please follow these steps to help us narrow down the problem https://github.com/microsoft/vscode/wiki/Performance-Issues

zenoven commented 5 years ago

same issue in 1.35.0, the VSC just suddenly run into this issue, exit VSC, restart, write some code and suddenly it just fired again and again.

in the 1.34 version I have the same issue too, it's really annoying.

egamma commented 5 years ago

@zenoven please follow this guide for how you can help us to narrow down performance issues https://github.com/microsoft/vscode/wiki/Performance-Issues.

anayak-alphasense commented 5 years ago

@egamma - I have updated to 1.35, but still the same issue persist. Could you please help me here?

wclr commented 5 years ago

@anayak-alphasense in your process info it seems some webpack thing fork-ts-checker-webpack-plugin eats CPU.

cesaraaron commented 5 years ago

Same problem here. 1.35 and even in insiders 1.36 c089daa858f34631f5f827ff8a0313bf1e2ded6d

It appears to be a problem with the integrated typescript server Screen Shot 2019-06-10 at 3 28 03 PM

mjbvz commented 5 years ago

@cesaraaron Please open a separate issue

@anayak-alphasense In your example, the high cpu usage looks like it is coming from a process you are running in the terminal. Can you confirm this?

anayak-alphasense commented 5 years ago

@mjbvz - Agree, But the same code is running smooth in other systems, not sure exactly what is the issue with my VS code.

mjbvz commented 5 years ago

So if you run the exact same command line script from a terminal outside of VS Code—with the same working directory and environment as you use inside of VS Code—you don't see this issue?

anayak-alphasense commented 5 years ago

Exactly, I tried running it via Git bash it worked smooth. Not sure if below screenshot can help you to find the issue tee ttt

mjbvz commented 5 years ago

@Tyriar can confirm but there isn't really much a cpu usage difference between your two examples, assuming those node processes are what you are running

marques-p44 commented 5 years ago

I'm also having an issue with typechecking and high CPU usage. It takes about 4 seconds for a typecheck to complete and show me an error, and the CPU for tsserver shoots up to 300% during that 4 seconds. I've disabled all extensions, even tried Insiders, still same issue. Here's a CPU profile: MCPU-20190620T190450.198Z.cpuprofile.txt

marques-p44 commented 5 years ago

Ok, I think the issue has to do with my TS project. If I just use CRA to make a basic app, typescript is nice and fast again. I'm even using the same tsconfig.json file in the basic app, but no problems at all.

mjbvz commented 5 years ago

@marques-p44 Please open a separate issue

mjbvz commented 5 years ago

Closing more info is needed from the original poster to determine if this is actually an issue with VS Code