Repository navigation
Description
System Details
- Operating system name and version: Windows_NT x64 10.0.16299
- VS Code version: Code 1.19.2 (490ef76, 2018-01-10T15:55:03.538Z)
- PowerShell extension version: 1.5.1
- Output from
$PSVersionTable:
Name Value
PSVersion 5.1.16299.98
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.98
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:
PS C:\> code -v
1.19.2
490ef761b76b3f3b3832eff7a588aac891e5fe80
x64
PS C:\> $pseditor.EditorServicesVersion
Major Minor Build Revision
----- ----- ----- --------
1 5 1 0
PS C:\> code --list-extensions --show-versions
[email protected]
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.16299.98
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.98
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Issue Description
- Open a Folder with a lot of files or Module files with a large amount of Functions defined in it. (Example files from this Repo: https://github.com/Microsoft/SDN)
- Open one of the PowerShell Files
- PowerShell.exe (started from Code.exe) uses 25% CPU (on a 4 Core System = 100% on one Core...)
- After a while the CPU usage goes down again
- Trigger Intelli Sense -> CPU Usage again very High and Intelli Sense hangs on "Loading..."
Version: Code 1.19.2 (490ef761b76b3f3b3832eff7a588aac891e5fe80, 2018-01-10T15:55:03.538Z)
OS Version: Windows_NT x64 10.0.16299)
CPUs: Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz (4 x 2496)
Memory (System): 15.93GB (7.99GB free)
VM: 0%
Screen Reader: no
CPU % Mem MB Process
0 78 code main
0 315 gpu-process
0 67 shared-process
0 188 window (SDNExpress_JFE.ps1 - SDN-master - Visual Studio Code)
0 10 watcherService
0 8 C:\WINDOWS\system32\conhost.exe 0x4
0 28 terminal
0 6 "c:\Program Files\Microsoft VS Code\resources\app\node_modules\node-pty\build\Release\winpty-agent.exe" \.\pipe\winpty-control-7796-1-1d3967ec27fef93-664c3d894748b76d3f352116efddddb4 0 1 80 24
0 11 C:\WINDOWS\system32\conhost.exe 0x4
24 316 C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "& 'C:\Users\JonasFeller.vscode\extensions\ms-vscode.powershell-1.5.1\scripts\Start-EditorServices.ps1' -EditorServicesVersion '1.5.1' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\JonasFeller.vscode\extensions\ms-vscode.powershell-1.5.1\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\JonasFeller.vscode\extensions\ms-vscode.powershell-1.5.1\logs\1516954929-6950478c-859d-424c-86f3-9e36396e80a31516954927200\EditorServices.log' -SessionDetailsPath 'C:\Users\JonasFeller.vscode\extensions\ms-vscode.powershell-1.5.1\sessions\PSES-VSCode-5568-943520' -FeatureFlags @()"
0 4 C:\WINDOWS\system32\cmd.exe /c ""C:\Program Files\Microsoft VS Code\bin\code.cmd" --status"
0 31 electron_node cli.js
0 51 "C:\Program Files\Microsoft VS Code\Code.exe" --status
0 72 powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& {& 'c:\Program Files\Microsoft VS Code\resources\app\out\vs\base\node\ps-win.ps1' -ProcessName 'Code.exe' -MaxSamples 3}"
0 7 C:\WINDOWS\system32\conhost.exe 0x4
0 29 gpu-process
0 57 extensionHost
Workspace Stats:
| Window (SDNExpress_JFE.ps1 - SDN-master - Visual Studio Code)
| Folder (SDN-master): 169 files
| File types: ps1(49) cmd(14) md(12) h(11) yaml(9) xml(8) c(8) cfg(6)
| sh(6) psd1(6)
| Conf files: sln(1)
It must be in context with the "x references" Code Lense functionality. When I disable Code Lense then the issue is gone.
Does anyone have the same? Maybe this is normal but it is not very pleasant. Especially the very very slow Intelli Sense.
Attached Logs
1516958023-f303492b-7f50-46e3-b6b0-8c643df4b0ac1516958020627.zip
Activity
[-]Function references Code Lense causes high CPU usage[/-][+]Function references Code Lense causes high CPU usage. Normal?[/+]TylerLeonhardt commentedon Jan 29, 2018
Thanks for this, Jonas Feller (@J0F3)!
If you have a workspace with a bunch of files, there will be perf issues because we look at all of the files in the workspace for Go To Definition and such. We can do better though. 😄
Also, I'm surprised your able to run VSCode with one core at all. I'm pretty sure that's close to impossible at the moment due to: electron/electron#1833
In any case, thanks for the report!
J0F3 commentedon Jan 31, 2018
That's what I've assumed. So I can fully understand that the search through the whole workspace takes some time. Especially if there are many files in the workspace. So no worries. 😊
However, beacuse of this behavior, I would find it nice, to have a setting to restrict the "reference search" to the current directory (without subdirectories) or even to the currently opened files.
Actually VSCode is not running on a single core. It is simply the powershell.exe, running Start-EditorServices.ps1, which has high CPU usage. (about 25% on a 4 core system).
no-escape commentedon Feb 27, 2018
I have the same issue and I can tell you, it is really painful to work with this. I have many script files in my workspace and just starting VS Code and integrated powershell terminal, the powershell.exe process, immediatelly takes up to 1.5GB memory without me doing any work, CPU core spikes to 100% usage for about a minute, then goes back down.
I have to be careful to actually NOT press ctrl+space for intellisense or the CPU will spike again for a minute leaving me unable to type properly or do anything else in VS Code for that matter, while this happens. I'd rather have no intellisense at all than having to deal with this. I am actually thinking about going back to ISESteroids just for this reason thats how frustrating it is.
I have also discovered that simply switching between open script files is causing CPU spikes. For example I have 5 files open and I switch to one of them which contains 5k lines of code => CPU goes 100% for 10 seconds. I switch to another one that is like 100 lines of code, CPU goes to 100% for only a second or two. Intellisense is a much bigger issue though. Performance overall is a big issue with PS extension in VS Code to be honest.
PS: by 100% cpu usage i mean only for the impacted core, just to be clear
AleksejsC commentedon Apr 6, 2018
Intellisense just not working for me anymore in big workspace. I open file I am working on in separate window. Very disappointed.
J0F3 commentedon Apr 6, 2018
I added as workaround the following setting in my settings.json:
This will however disable the "Function references" feature but instead Intellisense works again just fine in bigger work spaces.
TylerLeonhardt commentedon Apr 10, 2018
I'm been hypothesizing that codelens caused a big perf hit. Thanks for confirming that. This is one of the big perf related issues that need to be addressed.
andy-krivtsov commentedon Aug 7, 2018
Thanks a lot! I already thought about replacing VSCode to another IDE for powershell. Disabling CodeLens makes it usable again :)
XabiBeltza commentedon Dec 2, 2018
Wow! Disabling Codelens makes a huge difference on Big powershell projects. Would be nice to be able to scope the CodeLens feature, to only look for references on:
SydneyhSmith commentedon May 24, 2019
Closing as a duplicate of #1326