The built-in terminal in VSCode has poor performance
The built-in terminal in VSCode has poor performance. When the system background load is high, the output becomes very slow. Additionally, the terminal output in VSCode also consumes a considerable amount of CPU, which can be observed by writing a test that outputs large amounts of content to the terminal every 15ms. In contrast, Windows Terminal consumes almost no CPU.
Steps to Reproduce:
- Output a large amount of content to the console.
Same problem here, appearing recently (maybe the last week or so). I have a large csharp monorepo. Running the "build" task now takes ~8mins when it used to take <40sec.
I narrowed it down to the VS Code terminal. If I pipe output to /dev/null, it takes <40sec again. If I run the exact same task args in bash (Windows terminal, not the VS Code terminal), it takes <40sec regardless of piping output.
Can you try setting "terminal.integrated.windowsUseConptyDll": true, restarting and trying again? That will bring us closer to the backend that Windows Terminal is on (but not fully up to date) which has a bunch of performance improvements.
If you still see problems, provide a more detailed repro include the command line, exact shell/versions, windows version, vscode version, the rough contents of the file (size, ascii only?)
Can you try setting
"terminal.integrated.windowsUseConptyDll": true, restarting and trying again? That will bring us closer to the backend that Windows Terminal is on (but not fully up to date) which has a bunch of performance improvements.If you still see problems, provide a more detailed repro include the command line, exact shell/versions, windows version, vscode version, the rough contents of the file (size, ascii only?)
I don't think there's any improvement after setting it up, with VSCode version 1.106.3, PowerShell 7.5.4, and Windows 11 build 28000. You can execute the following in the console to demonstrate the performance difference:
$rng = [Random]::new(); while($true){ 1..100|%{'Random integer: {0}' -f $rng.Next()}; Start-Sleep -Milliseconds 15 }
What makes you say that's slow? CPU use is fine from what I can see in task manager and looking at a performance trace shows that each parse is sub 1ms:
Same with rendering:
What makes you say that's slow? CPU use is fine from what I can see in task manager and looking at a performance trace shows that each parse is sub 1ms:
@YexuanXiao can you share that trace via this button?
Also do you have a very large terminal.integrated.scrollback by chance?
@YexuanXiao can you share that trace via this button?
Also do you have a very large
terminal.integrated.scrollbackby chance?
The value for terminal.integrated.scrollback is 3000.
This doesn't look so bad, note that setTimeout/clearTimeout which is the bulk of this trace are inflated when doing a perf profile:
Can you define "considerable amount of CPU" and how you measured it?
We closed this issue because we are unable to reproduce the problem with the steps you describe. Chances are we've already fixed your problem in a recent version of VS Code. If not, please ask us to reopen the issue and provide us with more detail. Our issue reporting guidelines might help you with that.
Happy Coding!