Skip to content

Avoid animations during startup - #15204

Merged
Dustin L. Howett (DHowett) merged 1 commit into
mainfrom
dev/lhecker/startup-animations
Apr 20, 2023
Merged

Dustin L. Howett (DHowett) merged 1 commit into
mainfrom
dev/lhecker/startup-animations

Conversation

@lhecker

@lhecker Leonard Hecker (lhecker) commented Apr 18, 2023 •

Copy link
Copy Markdown
Member

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 where 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\\)

@lhecker

Leonard Hecker (lhecker) commented Apr 18, 2023 •

Copy link
Copy Markdown
Member Author

Before
before

After
after

Side effect: Scrollbars are more responsive now

w7rsxTfcrsAhEKgU.mp4

@DHowett
Dustin L. Howett (DHowett) force-pushed the dev/lhecker/lazy-command-palette branch from d11290c to 83bb7e0 Compare April 19, 2023 18:20
@DHowett
Dustin L. Howett (DHowett) force-pushed the dev/lhecker/startup-animations branch from 649f89b to 082aef0 Compare April 19, 2023 18:20
Base automatically changed from dev/lhecker/lazy-command-palette to main April 19, 2023 19:18
@DHowett
Dustin L. Howett (DHowett) force-pushed the dev/lhecker/startup-animations branch from 082aef0 to bf8d0b5 Compare April 19, 2023 19:32
auto bufferHeight = _core.BufferHeight();

ScrollBar().Maximum(bufferHeight - bufferHeight);
ScrollBar().Maximum(0);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HAHAHA

ScrollBar().Value(0);
ScrollBar().ViewportSize(bufferHeight);
ScrollBar().LargeChange(std::max(bufferHeight - 1, 0)); // scroll one "screenful" at a time when the scroll bar is clicked
ScrollBar().LargeChange(bufferHeight); // scroll one "screenful" at a time when the scroll bar is clicked

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there must have been a reason it was bufferHeight-1, right?

@lhecker Leonard Hecker (lhecker) Apr 19, 2023 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be because the original author compared the behavior against less, where PgUp/Down moves by 29 lines in a 30 line viewport. But that's because the 30th line is the ":" command prompt. Setting this to bufferHeight does do what you'd think it does (= page by 30 rows / the viewport height) and is the more correct behavior IMO.

@DHowett
Dustin L. Howett (DHowett) deleted the dev/lhecker/startup-animations branch April 20, 2023 12:31
Dustin L. Howett (DHowett) pushed a commit that referenced this pull request Apr 25, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Performance Performance-related issue Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants