You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WT should start up fast: profile the startup path and trim anything that takes a while #5907
Windows Terminal should be ready instantaneously like windows console, or like Sublime Text.
Windows Terminal can't be slower than windows console.
While Windows Terminal is fast compared with other tools like Visual Studio, or iTunes, it is still not fast enough for a Terminal application.
Actual behavior
It takes too long to startup. It is not ready instantaneously. It's not as fast as windows console.
maintainer note: hijacking OP for task list:
Use exactly one ColorPickerFlyout for all tabs, and just redirect it to whatever tab activated it.
Delayload the ColorPickerFlyout.
Add a setting to disable ALL fragments / dynamic profiles. The app catalog search is expensive.
Maybe we can just skip loading dynamic profiles on initial launch, unless we discover that the defaultProfile is a dynamic one... Nah, cause what about for defterm launches that end up matching a dynamic profile.
Reacted by Mohamed Daahir, Yaroslav Vorobev, Opher Shachar, Tragen, Radoslav Stoyanov, vannomad, Sebastian Sylvan, Oisin Grehan, Jecvay Liu, alexguirre and 28 more
I mean, the Terminal is doing a lot more than the console ever was. I'm not sure there's much more we can do to optimize our UI setup. Conhost was using basically the simplest Win32/GDI interface possible, and the Terminal needs to stand up a XAML stack. Even if we somehow had a server process that already had the settings pre-loaded, we'd still need to stand up the UI stack.
At least the Terminal is faster at processing output than the console ever was, and opening new tabs/panes is certainly faster than opening a new conhost is.
Maybe there's something we can do here to optimize the creation of the XAML stack.
7/21/2022 edit: putting this here so it doesn't ping everyone on this thread.
While investigating another issue:
parsing the json is the green column.
Looking for fragments is wholly 50% of the settings load cost
Az cloud Shell is another 20% (Just creating the IAzureConnectionStatics is that expensive? That's crazy. Hard to be sure, I don't have symbols working 😕)
In this trace:
TryLoadSettings is 44/284 for the AppHost ctor
ctoring the XAML resources is 62/284 for the AppHost ctor, of the 139 for just instantiating App
instantiating the CmdPal looks like another 30/284
Outside of the apphost ctor:
opening a new tab is like 53 (_CreateNewTabFromPane), creating the color picker flyout is 15 of that.
With the recent barrage of improvements, I've made a new perf trace today. This time using Nvidia Nsight Systems, because it has a neat way to represent delays (zoom in as needed):
Of the remaining ~400ms ~320ms launch cost of Windows Terminal, about 240ms (60% 75%) are due to WinUI and XAML. There are some things we can do about that, but it'll be very difficult, because WinUI isn't exactly easy to manipulate into being lean. For instance, the C++ XAML generator has a bug, where it doesn't emit metadata for system types into our metadata cache. When WinUI then starts, it tries to look up those system types, can't find them and will look around in all registered user providers. This causes Microsoft.Terminal.Settings.Model.dll and everything else to be loaded, which takes ~10% (maybe more). Preventing this isn't easily possible, because creating 2 metadata caches (one for WT and one for the settings model) isn't documented and probably not supported. Most of the time is spent in the layout and rendering code1 though and that's an area we can't improve upon.
Another 80ms (20%) are caused by our workaround for #11648, a bug which still isn't fixed in Windows unfortunately. I've been thinking about just adding a setting that will load the nearby fonts if the setting is enabled. I don't think caching the font size is a good idea because that would only improve launch time by 10% instead of the expected 20%. It would worsen the user experience for some but improve it for others. This is what I'd like to fix asap. It's the easiest improvement we can make at this point. Fixed.
The remaining 80ms (20%) will be difficult to fix. For instance, HWND creation costs 20ms and we need at least 2 (main thread + 1 for each window). Setting up the Monarch COM server and negotiating that costs another 5-10ms, by nature of COM setup being slow. We allow loading fragments via the app extension catalog, which is an LPC and extremely slow (10ms for returning an empty list). That's almost the entire cost already.
As Terminal users, we can upvote certain issues/bugs (that are preventing Terminal from being faster) on XAML github if they have github repo and you link these bugs :) same for any linked Feedback items about general appx slowness which you consider slowing Terminal.
Also, earlier I noted that my Terminal loads a ton of unrelated DLLs, including something related to Maps controls.
If I may add anything functional here. I can imagine that a possible solution would be to differentiate between 2 different ways of starting the Terminal:
Opening the application by explicitly clicking it as a user, whether that is via a shortcut or the right click menu in a folder.
Automatic launches by several console application executions when being configured as the default terminal in Windows, which would otherwise launch the old conhost.exe console window of windows.
When launching the first way, I love features, and startup time does not matter that much.
When launching the second way, the application should be absolutely blazingly fast by really not loading any more resources than it needs. Because these launches can happen a lot of time after each other. For example when running any kind of automated batch operation.
I don't know if this is possible, but it might be helpful as an idea.
Reacted by Vadim Kantorov, Jon Newton, Simon Felix, 70sh1, Kevin Giovinazzo, soredake, fiso64 and Erithax
Removing the Azure profile resolved slow startup times in WT-Preview, before there was a constant 600ms delay spent "loading user and system profiles"
Windows Terminal does not control what happens during "loading user and system profiles" inside powershell. None of Terminal's profiles are used in that process.
The term "profile" is overloaded here; they mean Profile.ps1 (and friends.)
Removing the Azure profile resolved slow startup times in WT-Preview, before there was a constant 600ms delay spent "loading user and system profiles"
Windows Terminal does not control what happens during "loading user and system profiles" inside powershell. None of Terminal's profiles are used in that process.
The term "profile" is overloaded here; they mean Profile.ps1 (and friends.)
very odd. been having a consistent "startup took ~600ms", removed the other "windows terminal" profiles and it went away. Whos printing the startup delay, its through powershell isnt it?
Yes, it's PowerShell. The powershell.exe process starts up, loads up the CLR, starts up a PowerShell host engine, starts parsing everything and then prints the message when it's done.
Terminal's job here is to spawn powershell.exe and then read the text it prints.
Activity
zadjii-msft commentedon May 14, 2020
I mean, the Terminal is doing a lot more than the console ever was. I'm not sure there's much more we can do to optimize our UI setup. Conhost was using basically the simplest Win32/GDI interface possible, and the Terminal needs to stand up a XAML stack. Even if we somehow had a server process that already had the settings pre-loaded, we'd still need to stand up the UI stack.
At least the Terminal is faster at processing output than the console ever was, and opening new tabs/panes is certainly faster than opening a new conhost is.
Maybe there's something we can do here to optimize the creation of the XAML stack.
7/21/2022 edit: putting this here so it doesn't ping everyone on this thread.
While investigating another issue:
IAzureConnectionStaticsis that expensive? That's crazy. Hard to be sure, I don't have symbols working 😕)TryLoadSettingsis 44/284 for theAppHostctorAppHostctor, of the 139 for just instantiatingApp_CreateNewTabFromPane), creating the color picker flyout is 15 of that.mdtauk commentedon May 14, 2020
zadjii-msft commentedon May 14, 2020
AnuthaDev commentedon May 14, 2020
zadjii-msft commentedon May 14, 2020
mdtauk commentedon May 14, 2020
48 remaining items
Lazy load CommandPalette and AboutDialog (#15196)
Lazy load CommandPalette and AboutDialog (#15203)
Avoid animations during startup (#15204)
lhecker commentedon Apr 24, 2023
With the recent barrage of improvements, I've made a new perf trace today. This time using Nvidia Nsight Systems, because it has a neat way to represent delays (zoom in as needed):
Of the remaining
~400ms~320ms launch cost of Windows Terminal, about 240ms (60%75%) are due to WinUI and XAML. There are some things we can do about that, but it'll be very difficult, because WinUI isn't exactly easy to manipulate into being lean. For instance, the C++ XAML generator has a bug, where it doesn't emit metadata for system types into our metadata cache. When WinUI then starts, it tries to look up those system types, can't find them and will look around in all registered user providers. This causesMicrosoft.Terminal.Settings.Model.dlland everything else to be loaded, which takes ~10% (maybe more). Preventing this isn't easily possible, because creating 2 metadata caches (one for WT and one for the settings model) isn't documented and probably not supported. Most of the time is spent in the layout and rendering code1 though and that's an area we can't improve upon.Another 80ms (20%) are caused by our workaround for #11648, a bug which still isn't fixed in Windows unfortunately. I've been thinking about just adding a setting that will load the nearby fonts if the setting is enabled. I don't think caching the font size is a good idea because that would only improve launch time by 10% instead of the expected 20%. It would worsen the user experience for some but improve it for others. This is what I'd like to fix asap. It's the easiest improvement we can make at this point.Fixed.The remaining 80ms (20%) will be difficult to fix. For instance, HWND creation costs 20ms and we need at least 2 (main thread + 1 for each window). Setting up the Monarch COM server and negotiating that costs another 5-10ms, by nature of COM setup being slow. We allow loading fragments via the app extension catalog, which is an LPC and extremely slow (10ms for returning an empty list). That's almost the entire cost already.
Footnotes
FizzBuzzEnterpriseEdition ↩
Avoid animations during startup (#15204)
Avoid loading nearby fonts unless necessary (#15239)
vadimkantorov commentedon May 5, 2023
As Terminal users, we can upvote certain issues/bugs (that are preventing Terminal from being faster) on XAML github if they have github repo and you link these bugs :) same for any linked Feedback items about general appx slowness which you consider slowing Terminal.
Also, earlier I noted that my Terminal loads a ton of unrelated DLLs, including something related to Maps controls.
eduarddejong commentedon Jul 3, 2023
If I may add anything functional here. I can imagine that a possible solution would be to differentiate between 2 different ways of starting the Terminal:
When launching the first way, I love features, and startup time does not matter that much.
When launching the second way, the application should be absolutely blazingly fast by really not loading any more resources than it needs. Because these launches can happen a lot of time after each other. For example when running any kind of automated batch operation.
I don't know if this is possible, but it might be helpful as an idea.
tadghh commentedon Sep 27, 2024
Removing the Azure profile resolved slow startup times in WT-Preview, before there was a constant 600ms delay spent "loading user and system profiles"

DHowett commentedon Sep 27, 2024
Windows Terminal does not control what happens during "loading user and system profiles" inside powershell. None of Terminal's profiles are used in that process.
The term "profile" is overloaded here; they mean
Profile.ps1(and friends.)tadghh commentedon Sep 27, 2024
very odd. been having a consistent "startup took ~600ms", removed the other "windows terminal" profiles and it went away. Whos printing the startup delay, its through powershell isnt it?
DHowett commentedon Sep 27, 2024
Yes, it's PowerShell. The
powershell.exeprocess starts up, loads up the CLR, starts up a PowerShell host engine, starts parsing everything and then prints the message when it's done.Terminal's job here is to spawn powershell.exe and then read the text it prints.