Skip to content

Perf opportunity, call RoGetActivationFactory much less often in xaml #6043

@ChrisGuzak

Description

@ChrisGuzak

Describe the bug

I traced every RoGetActivationFactory being made when Xaml starts up and I see a lot of calls that can be avoided if the factories were cached like they are in cppwinrt.

    // When launching the  window and letting it paint, I observed
    // 206 calls to RoGetActivationFactory or RoGetClassObject
    // 68 unique names were passed.
    // If cached 138 (206-68) will be saved.
    // (206-68)/206 = ~67% calls will be cached.

I've got a drop-in replacement for the direct API use that implements caching and can share that with those interested in seeing what effect this has.

Steps to reproduce the bug

I used the VS debugger ability to trace on method calls, setting breakpoints on these APIs. and launching the bare bones WinUI App sample template.

observe redundant calls

Expected behavior

no redundancy, DRY.

Screenshots

No response

NuGet package version

None

Packaging type

No response

Windows version

No response

IDE

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions