-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
WT should start up fast: profile the startup path and trim anything that takes a while #5907
Comments
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:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This commit reduces the amount of telemetry during general usage by about half. 8 events that weren't really used anymore were removed. 1 new event was added ("AppInitialized") which will help us investigate #5907. During review 9 events were found that were incorrectly tagged as perf. data. * Launch Windows Terminal * The "latency" field "AppInitialized" matches the approx. launch time ✅ (cherry picked from commit 37c159a) Service-Card-Id: 85548958 Service-Version: 1.15
Discussion idea:
|
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
In #15001 a related usecase: Windows OS running some autoruns do quick |
This sets `x:Load` to `false` for the two elements. On my system, with Windows Defender disabled, this reduces CPU usage by 15ms and the visual delay during launch by 40ms. Part of #5907 ## PR Checklist * Ctrl+Shift+P opens command palette ✅ * Context menu opens command palette ✅ * Context menu opens about dialog ✅
This sets `x:Load` to `false` for the two elements. On my system, with Windows Defender disabled, this reduces CPU usage by 15ms and the visual delay during launch by 40ms. Part of #5907 ## Validation Steps Performed * Ctrl+Shift+P opens command palette ✅ * Context menu opens command palette ✅ * Context menu opens about dialog ✅
This fixes 3 sources for animations: * `TabView`'s `EntranceThemeTransition` causes tabs to slowly slide in from the bottom. Removing the transition requires you to override the entire list of transitions obviously, which is a global change. Nice. Am I glad I don't need to deal with the complexity of CSS. /s * `TabBase`, `SettingsTab` and `TerminalTab` were using a lot of coroutines with `resume_foreground` even though almost none of the functions are called from background tabs in the first place. This caused us to miss the initial XAML drawing pass, which resulted in animations when the tab icons would asynchronously pop into existence. It also appears as if `resume_foreground`, etc. have a very high CPU cost attached, which surprises me absolutely not at all given WinRT. The improvement is difficult to quantify because the run to run variation is very high. But it seems like this shaves about 10% off of the ~500ms startup delay on my PC depending on how you measure it. Part of #5907 ## PR Checklist * It starts when it should ✅ * It doesn't "exit" when it shouldn't ✅ (Scrolling, Settings reload, Bell `\a`, Progress `\e]9;4;2;80\e\\`)
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
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
|
This fixes 3 sources for animations: * `TabView`'s `EntranceThemeTransition` causes tabs to slowly slide in from the bottom. Removing the transition requires you to override the entire list of transitions obviously, which is a global change. Nice. Am I glad I don't need to deal with the complexity of CSS. /s * `TabBase`, `SettingsTab` and `TerminalTab` were using a lot of coroutines with `resume_foreground` even though almost none of the functions are called from background tabs in the first place. This caused us to miss the initial XAML drawing pass, which resulted in animations when the tab icons would asynchronously pop into existence. It also appears as if `resume_foreground`, etc. have a very high CPU cost attached, which surprises me absolutely not at all given WinRT. The improvement is difficult to quantify because the run to run variation is very high. But it seems like this shaves about 10% off of the ~500ms startup delay on my PC depending on how you measure it. Part of #5907 * It starts when it should ✅ * It doesn't "exit" when it shouldn't ✅ (Scrolling, Settings reload, Bell `\a`, Progress `\e]9;4;2;80\e\\`) (cherry picked from commit 35b9e75) Service-Card-Id: 89001994 Service-Version: 1.17
`IDWriteFontSetBuilder` is super expensive (~40ms of CPU for building a single font set on a high-end CPU from ~2021). Let's avoid the cost, by only constructing it if Cascadia Code is actually missing. To not overcomplicate the code and to support any additional fonts we might ship in the future, I'm not checking for the font name, and instead I just construct the font set whenever any font is missing. Part of #5907 ## Validation Steps Performed * Breakpoints in FontCache aren't hit ✅ * App doesn't crash ✅
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:
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. |
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 |
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 Terminal's job here is to spawn powershell.exe and then read the text it prints. |
Steps to reproduce
Expected behavior
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:
ColorPickerFlyout
for all tabs, and just redirect it to whatever tab activated it.ColorPickerFlyout
.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.The text was updated successfully, but these errors were encountered: