WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

Dynamic dependencies have a significant impact on application startup time

Open lhak opened this issue 1 year ago • 5 comments

Describe the bug

Looking at startup time of winui applications, I noticed that using dynamic dependencies for unpackaged apps has a significant impact. Compared to using appsdk self contained deployment, using dynamic dependencies increases startup time by 100-300ms depending on processor speed.

Interestingly, using the Windows functions TryCreatePackageDependency() and AddPackageDependency() for the appsdk runtime package results in a lot better performance. So I guess improvements should be possible here.

Steps to reproduce the bug

Use https://github.com/jonathanpeppers/measure-startup to measure the startup time of unpackaged apps with and without appsdk self contained deployment enabled.

Expected behavior

No response

Screenshots

No response

NuGet package version

Windows App SDK 1.6.0: 1.6.240829007

Packaging type

Unpackaged

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022

Additional context

No response

lhak avatar Sep 07 '24 18:09 lhak

There was work being done to just use the Windows 11 Dynamic Dependencies API when available, I wonder what happened to it.

DarranRowe avatar Sep 08 '24 00:09 DarranRowe

this is the PR: https://github.com/microsoft/WindowsAppSDK/pull/4136

mominshaikhdevs avatar Sep 10 '24 07:09 mominshaikhdevs

Interestingly, using the Windows functions TryCreatePackageDependency() and AddPackageDependency() for the appsdk runtime package results in a lot better performance

Not too surprising. We made changes inside Windows to enable that behavior. Unfortunately these changes required pretty deeply invasive (read: high risk) changes to make downlevel, thus WinAppSDK has its own parallel implementation that approximates the same net result but using mechanisms already available on e.g. RS5. So the latter works (yay!) but can't be quite as lean as the former.

DrusTheAxe avatar Sep 12 '24 06:09 DrusTheAxe

There was work being done to just use the Windows 11 Dynamic Dependencies API when available, I wonder what happened to it.

It ran into a couple of deep technical snags requiring more time than available to sort out so it got deferred (sleepy, not dead :-)

But for all things a season... I've started digging back into this. It's a little tricky to thread the needle to enable without introducing regressions, but I'm cautiously optimistic it'll get it sorted out soon enough.

I've actually been itching to get my hands on this for a while. Looking forward to hacking away, even if it's a meticulous hackery. Stay tuned.

DrusTheAxe avatar Sep 12 '24 06:09 DrusTheAxe

FYI MS tracking => https://task.ms/47326505

DrusTheAxe avatar Sep 12 '24 06:09 DrusTheAxe

Looks like this has been resolved. Impact on startup time has been reduced drastically.

lhak avatar Oct 21 '25 20:10 lhak