Skip to content
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

Slow output rendering in terminal when ConPty is enabled #72634

Closed
janegilring opened this issue Apr 20, 2019 · 5 comments
Closed

Slow output rendering in terminal when ConPty is enabled #72634

janegilring opened this issue Apr 20, 2019 · 5 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster terminal General terminal issues that don't fall under another label

Comments

@janegilring
Copy link

Issue Type: Performance Issue

When running a command which produces a long list of output, the rendering in the terminal is very slow. Here is an example running Get-Process in PowerShell Core 6.2:
Get-Process
Get-History -Count 1 | Format-Table Commandline,Duration

CommandLine Duration
Get-Process 00:00:26.3913173

The same command run with ConPty disabled:
CommandLine Duration
Get-Process 00:00:00.7955070

The same command run outside of VS Code (from pwsh.exe):
CommandLine Duration
Get-Process 00:00:00.7453859

VS Code version: Code 1.33.1 (51b0b28, 2019-04-11T08:27:14.102Z)
OS version: Windows_NT x64 10.0.18362

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz (4 x 2808)
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
Memory (System) 15.93GB (3.46GB free)
Process Argv
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    2	   108	  7724	code main
    0	   416	  3464	   window (undefined)
    0	   327	  6212	   window (profile.ps1 - WindowsPowerShell - Visual Studio Code)
    0	     5	  6684	     console-window-host (Windows internal process)
    0	   204	  8780	     "C:\Program Files\PowerShell\6\pwsh.exe" -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "& 'C:\Users\janring\.vscode\extensions\ms-vscode.powershell-1.12.1\modules\PowerShellEditorServices\Start-EditorServices.ps1' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.12.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\janring\.vscode\extensions\ms-vscode.powershell-1.12.1\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\janring\.vscode\extensions\ms-vscode.powershell-1.12.1\logs\1555734840-ba0f8cd2-2191-4408-9d02-d80b8966f56f1555702179639\EditorServices.log' -SessionDetailsPath 'C:\Users\janring\.vscode\extensions\ms-vscode.powershell-1.12.1\sessions\PSES-VSCode-7724-999400' -FeatureFlags @()"
    0	   177	  8924	     extensionHost
    0	    29	 15300	       "C:\Users\janring\AppData\Local\Programs\Microsoft VS Code\Code.exe" "c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain" --node-ipc --clientProcessId=8924
    0	    30	 17632	       electron_node server.js 
    0	    26	 18288	       electron_node server.js 
    0	    12	 14404	     watcherService 
    0	     5	 13384	       console-window-host (Windows internal process)
    0	    11	 16380	     electron-crash-reporter
    0	     3	 17676	     C:\WINDOWS\System32\cmd.exe
    0	     6	 18444	     console-window-host (Windows internal process)
    0	    70	 12168	   shared-process
    3	    60	 17864	   window (Issue Reporter)
    3	   488	 18156	   gpu-process
Workspace Info
|  Window (profile.ps1 - WindowsPowerShell - Visual Studio Code)
|    Folder (WindowsPowerShell): 1353 files
|      File types: ps1(1126) psm1(33) psd1(31) xml(27) ps1xml(22) txt(18)
|                  csv(17) json(10) png(10) md(8)
|      Conf files: sln(1);
Extensions (34)
Extension Author (truncated) Version
swagger-viewer Arj 2.2.2
armsnippet art 0.7.0
bracket-pair-colorizer-2 Coe 0.0.28
vscode-markdownlint Dav 0.26.0
vscode-instant-markdown dba 1.4.3
githistory don 0.4.6
vscode-pandoc Dou 0.0.8
gitlens eam 9.6.2
powershellprotools iro 4.4.0
vscode-peacock joh 2.1.0
terraform mau 1.3.9
rainbow-csv mec 1.0.0
azure-pipelines ms- 1.147.2
vscode-azureappservice ms- 0.13.0
vscode-azurefunctions ms- 0.16.0
vscode-azurestorage ms- 0.7.0
vscode-azureterraform ms- 0.2.3
vscode-logicapps ms- 0.1.17
python ms- 2019.3.6558
azure-account ms- 0.8.2
azurecli ms- 0.4.4
powershell ms- 1.12.1
vsliveshare ms- 1.0.67
team ms- 1.149.2
azurerm-vscode-tools msa 0.5.0
indent-rainbow ode 7.4.0
vscode-docker Pet 0.6.1
material-icon-theme PKi 3.7.0
vscode-coverage-gutters rya 2.3.1
code-settings-sync Sha 3.2.9
guides spy 0.9.3
shell-launcher Tyr 0.3.0
gitblame wad 2.7.0
markdown-all-in-one yzh 2.2.0

(1 theme extensions excluded)

@vscodebot vscodebot bot added the terminal General terminal issues that don't fall under another label label Apr 20, 2019
@janegilring
Copy link
Author

I tried to enable escape sequence logging, and see the following in the console in the developer tools when re-running Get-Process:
c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:1084 Unknown CSI code: {collect: "", params: Array(1), flag: "C"}
Terminal.error @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:1084
(anonymous) @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\InputHandler.js:73
EscapeSequenceParser.parse @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\EscapeSequenceParser.js:407
InputHandler.parse @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\InputHandler.js:191
Terminal._innerWrite @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:893
(anonymous) @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:873
setTimeout (async)
Terminal.write @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:872
Terminal.write @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\public\Terminal.js:125
_onProcessData @ terminalInstance.ts:928
_processManager._processManager.onProcessData.e @ terminalInstance.ts:429
fire @ event.ts:584
l.onProcessData.e @ terminalProcessManager.ts:186
fire @ event.ts:584
_ptyProcess.on.e @ terminalProcess.ts:79
emit @ events.js:187
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:260
Readable.push @ _stream_readable.js:219
onread @ net.js:636
c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:1084 Unknown CSI code: {collect: "", params: Array(1), flag: "X"}
Terminal.error @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:1084
(anonymous) @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\InputHandler.js:73
EscapeSequenceParser.parse @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\EscapeSequenceParser.js:407
InputHandler.parse @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\InputHandler.js:191
Terminal._innerWrite @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:893
(anonymous) @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:873
setTimeout (async)
Terminal.write @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:872
Terminal.write @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\public\Terminal.js:125
_onProcessData @ terminalInstance.ts:928
_processManager._processManager.onProcessData.e @ terminalInstance.ts:429
fire @ event.ts:584
l.onProcessData.e @ terminalProcessManager.ts:186
fire @ event.ts:584
_ptyProcess.on.e @ terminalProcess.ts:79
emit @ events.js:187
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:260
Readable.push @ _stream_readable.js:219
onread @ net.js:636
c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:1084 Unknown CSI code: {collect: "", params: Array(1), flag: "C"}
Terminal.error @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:1084
(anonymous) @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\InputHandler.js:73
EscapeSequenceParser.parse @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\EscapeSequenceParser.js:407
InputHandler.parse @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\InputHandler.js:191
Terminal._innerWrite @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:893
(anonymous) @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:873
setTimeout (async)
Terminal.write @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:872
Terminal.write @ c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\public\Terminal.js:125
_onProcessData @ terminalInstance.ts:928
_processManager._processManager.onProcessData.e @ terminalInstance.ts:429
fire @ event.ts:584
l.onProcessData.e @ terminalProcessManager.ts:186
fire @ event.ts:584
_ptyProcess.on.e @ terminalProcess.ts:79
emit @ events.js:187
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:260
Readable.push @ _stream_readable.js:219
onread @ net.js:636
c:\Users\janring\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Terminal.js:1084 Unknown CSI code: {collect: "", params: Array(1), flag: "X"}

@Tyriar
Copy link
Member

Tyriar commented Apr 20, 2019

I could reproduce this on my work machine, for me it was an issue with GPU/canvas drawing performance and the simple fix it to add this to your settings:

"terminal.integrated.rendererType": "dom"

It's meant to switch this setting automatically if you haven't set it already and this sort of slow down happens 🤔

https://github.com/Microsoft/vscode/blob/50c9a782ad2cf3b1b662966455187f8a9ec41bac/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts#L646

Does that fix your problem?

@Tyriar Tyriar added the info-needed Issue requires more information from poster label Apr 20, 2019
@janegilring
Copy link
Author

The setting was already present when I tried to add it. However, it might have been added automatically, as performance seems to be much improved now.

CommandLine Duration
gps 00:00:05.8818659

I haven`t done anything besides closing/re-opening VS Code a few times during testing.

@wjrogers
Copy link

wjrogers commented Jun 6, 2019

I've been having a similar problem for a couple VS Code versions, I think all since conpty support landed. Today, I tried the dom renderer setting, and it fixed the slow terminal output. FWIW, I often use Code via RDP, but I'm pretty sure I observed the same problem on the same machine working locally.

Code 1.35.0
Windows 10 Pro 1903 build 18362.113

@Tyriar
Copy link
Member

Tyriar commented Jun 6, 2019

This was also reported in #74914, I think the root cause is the event loop related stuff in #74620

@Tyriar Tyriar closed this as completed Jun 6, 2019
@Tyriar Tyriar added the *duplicate Issue identified as a duplicate of another issue(s) label Jun 6, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster terminal General terminal issues that don't fall under another label
Projects
None yet
Development

No branches or pull requests

3 participants