Both WT and Powershell are great, but the startup is a little slow when combined together. And my some thoughts. #22039

Open
opened 2026-01-31 08:01:43 +00:00 by claunia · 0 comments
Owner

Originally created by @flyingcat on GitHub (Aug 1, 2024).

Description of the new feature/enhancement

As the title described. On my computer(AMD Ryzen 3600, even slower on Snapdragon 8cx Gen 3):

 D:\tmpdir\terminal-1.22.2081.0
> Measure-Command { Start-Process .\WindowsTerminal.exe -PassThru 'pwsh','-c','exit' | Wait-Process } | % TotalMilliseconds
757.2283

I do want to help, but after some digging into the code, it quickly turn out that its complexity is far beyond my level. However I think the ideas maybe somehow helpful for core team, so I just take some time to this.

Proposed technical implementation details (optional)

  1. Start profile's command line as early as possible, ideally right after settings loaded. Then the startup of pwsh.exe will overlap with UI initialization. However I don't know it's valid or not, as I am not familiar with terminal things.
    image

  2. Made subsequent process run faster. Currently it need to load the whole settings to get the value of compatibility.isolatedMode , which in turn cause time-consuming WindowsXamlManager::InitializeForCurrentThread() in App::App(). It should be avoided, or better, avoid loading the whole settings too.

     D:\tmpdir\terminal-1.22.2081.0
    > .\WindowsTerminal.exe; Start-Sleep 2; Measure-Command { Start-Process .\WindowsTerminal.exe -PassThru | Wait-Process } | % TotalMilliseconds
    175.0779
    
  3. Create spare window thread on idle time after new window showed. Add an option to allow keep running in background just like Edge and tweak auto launch on boot to adapt it. Now event if the first is hard to implement and pwsh.exe is still slow to start, we at least always get quick UI response.

Originally created by @flyingcat on GitHub (Aug 1, 2024). # Description of the new feature/enhancement As the title described. On my computer(AMD Ryzen 3600, even slower on Snapdragon 8cx Gen 3): ```powershell → D:\tmpdir\terminal-1.22.2081.0 > Measure-Command { Start-Process .\WindowsTerminal.exe -PassThru 'pwsh','-c','exit' | Wait-Process } | % TotalMilliseconds 757.2283 ``` I do want to help, but after some digging into the code, it quickly turn out that its complexity is far beyond my level. However I think the ideas maybe somehow helpful for core team, so I just take some time to this. # Proposed technical implementation details (optional) 1. Start profile's command line as early as possible, ideally right after settings loaded. Then the startup of pwsh.exe will overlap with UI initialization. However I don't know it's valid or not, as I am not familiar with terminal things. ![image](https://github.com/user-attachments/assets/b6705d47-3636-43b9-8797-fea21bd1476d) 2. Made subsequent process run faster. Currently it need to load the whole settings to get the value of `compatibility.isolatedMode` , which in turn cause time-consuming `WindowsXamlManager::InitializeForCurrentThread()` in `App::App()`. It should be avoided, or better, avoid loading the whole settings too. ```powershell → D:\tmpdir\terminal-1.22.2081.0 > .\WindowsTerminal.exe; Start-Sleep 2; Measure-Command { Start-Process .\WindowsTerminal.exe -PassThru | Wait-Process } | % TotalMilliseconds 175.0779 ``` 3. Create spare window thread on idle time after new window showed. Add an option to allow keep running in background just like Edge and tweak auto launch on boot to adapt it. Now event if the first is hard to implement and pwsh.exe is still slow to start, we at least always get quick UI response.
claunia added the Issue-FeatureNeeds-TriageNeeds-Tag-Fix labels 2026-01-31 08:01:43 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22039