Skip to content
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

Lazily load the settings UI DLL #15628

Merged
merged 1 commit into from Jun 28, 2023
Merged

Lazily load the settings UI DLL #15628

merged 1 commit into from Jun 28, 2023

Conversation

DHowett
Copy link
Member

@DHowett DHowett commented Jun 28, 2023

Due to an implementation detail in the Xaml compiler--which wants to ensure that all metadata providers on an App are available immediately--we were eagerly loading the settings UI DLL and all of its dependencies, even in sessions where the user was not going to open Settings.

By turning off eager provider generation and handling it ourselves, we get to control exactly when the settings UI is loaded.

This required some gentle poking-through of the barrier between App and Page, but it is almost certainly worth it.

Turning on the Xaml code generation flag to not generate providers automatically adds an AddProvider member to the internal interface for the autogenerated XamlMetadataProvider. We needed to switch to using the internal interface rather than the projected type in our custom App base class to get at it.

Providers that App/Page use must be initialized by the time we start the WindowsXamlManager, so we load Control and Controls (ha) eagerly and early.

It looks like it may save 400ms of CPU time (?) on startup.

Due to an implementation detail in the Xaml compiler--which wants to
ensure that all metadata providers on an App are available
immediately--we were eagerly loading the settings UI DLL and all of its
dependencies, even in sessions where the user was not going to open
Settings.

By turning off eager provider generation and handling it ourselves, we
get to control exactly when the settings UI is loaded.

This required some gentle poking-through of the barrier between App and
Page, but it is almost certainly worth it.

Turning on the Xaml code generation flag to not generate providers
automatically adds an `AddProvider` member to the internal interface for
the autogenerated XamlMetadataProvider. We needed to switch to using the
internal interface rather than the projected type in our custom App base
class to get at it.

Providers that App/Page use must be initialized by the time we start the
WindowsXamlManager, so we load Control and Controls (ha) eagerly and
early.
Copy link
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

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

👻

@DHowett DHowett merged commit 0f41851 into main Jun 28, 2023
18 checks passed
@DHowett DHowett deleted the dev/duhowett/lazy-lazy-lazy! branch June 28, 2023 20:32
DHowett added a commit that referenced this pull request Jun 29, 2023
When we moved the settings UI to lazy initialization in #15628, we broke
PGO. Apparently, we were PGOing the tiny part of Settings that was
being loaded on every launch (e.g. the XAML metadata provider 🤦)

Let's actually PGO launching the settings.
DHowett added a commit that referenced this pull request Jun 29, 2023
When we moved the settings UI to lazy initialization in #15628, we broke
PGO. Apparently, we were PGOing the tiny part of Settings that was being
loaded on every launch (e.g. the XAML metadata provider 🤦)

Let's actually PGO launching the settings.
@DHowett DHowett added this to To Cherry Pick in 1.17 Servicing Pipeline via automation Jul 27, 2023
@DHowett DHowett added this to To Cherry Pick in 1.18 Servicing Pipeline via automation Jul 27, 2023
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.17 Servicing Pipeline Jul 27, 2023
DHowett added a commit that referenced this pull request Jul 27, 2023
Due to an implementation detail in the Xaml compiler--which wants to
ensure that all metadata providers on an App are available
immediately--we were eagerly loading the settings UI DLL and all of its
dependencies, even in sessions where the user was not going to open
Settings.

By turning off eager provider generation and handling it ourselves, we
get to control exactly when the settings UI is loaded.

This required some gentle poking-through of the barrier between App and
Page, but it is almost certainly worth it.

Turning on the Xaml code generation flag to not generate providers
automatically adds an `AddProvider` member to the internal interface for
the autogenerated XamlMetadataProvider. We needed to switch to using the
internal interface rather than the projected type in our custom App base
class to get at it.

Providers that App/Page use must be initialized by the time we start the
WindowsXamlManager, so we load Control and Controls (ha) eagerly and
early.

It looks like it may save 400ms of CPU time (?) on startup.

(cherry picked from commit 0f41851)
Service-Card-Id: 90012538
Service-Version: 1.17
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.18 Servicing Pipeline Jul 27, 2023
DHowett added a commit that referenced this pull request Jul 27, 2023
Due to an implementation detail in the Xaml compiler--which wants to
ensure that all metadata providers on an App are available
immediately--we were eagerly loading the settings UI DLL and all of its
dependencies, even in sessions where the user was not going to open
Settings.

By turning off eager provider generation and handling it ourselves, we
get to control exactly when the settings UI is loaded.

This required some gentle poking-through of the barrier between App and
Page, but it is almost certainly worth it.

Turning on the Xaml code generation flag to not generate providers
automatically adds an `AddProvider` member to the internal interface for
the autogenerated XamlMetadataProvider. We needed to switch to using the
internal interface rather than the projected type in our custom App base
class to get at it.

Providers that App/Page use must be initialized by the time we start the
WindowsXamlManager, so we load Control and Controls (ha) eagerly and
early.

It looks like it may save 400ms of CPU time (?) on startup.

(cherry picked from commit 0f41851)
Service-Card-Id: 90012539
Service-Version: 1.18
@DHowett DHowett moved this from Cherry Picked to Validated in 1.17 Servicing Pipeline Aug 2, 2023
DHowett added a commit that referenced this pull request Aug 14, 2023
When we moved the settings UI to lazy initialization in #15628, we broke
PGO. Apparently, we were PGOing the tiny part of Settings that was being
loaded on every launch (e.g. the XAML metadata provider 🤦)

Let's actually PGO launching the settings.

(cherry picked from commit 80f2776)
Service-Card-Id: 90213941
Service-Version: 1.18
@lhecker lhecker moved this from Cherry Picked to Validated in 1.18 Servicing Pipeline Sep 25, 2023
@DHowett DHowett moved this from Validated to Shipped in 1.18 Servicing Pipeline Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants