Skip to content

[Perf] Investigate the impact of RuntimeNativeMethods._monodroid_*_log on startup performance #11104

@simonrozsival

Description

@simonrozsival

I collected a startup trace of dotnet new maui app on Android and this is what the top 10 methods were

>_ dotnet trace report TestDummy_20260410_150148.nettrace topN -n 10
Top 10 Functions (Exclusive)                                                  Inclusive           Exclusive
1.  WaitSubsystem+ThreadWaitInfo.Wait(int32,bool,bool,value class LockHold    71.9%               71.9%
2.  sockets!Interop+Sys.WaitForSocketEvents(int,value class SocketEvent*,i    17.69%              17.69%
3.  RuntimeNativeMethods._monodroid_gref_log(class System.String)             4.4%                4.4%
4.  GC.RunFinalizers()                                                        6.32%               1.78%
5.  CustomAttribute.IsCustomAttributeDefined(class System.Reflection.Runti    0.69%               0.52%
6.  RuntimeNativeMethods._monodroid_lref_log_delete(int32,int,unsigned int    0.53%               0.52%
7.  RuntimeNativeMethods._monodroid_lref_log_new(int32,int,unsigned int8,c    0.5%                0.49%
8.  StackTrace.GetStackFramesInternal(class System.Diagnostics.StackFrameH    0.31%               0.31%
9.  ManagedValueManager.PeekPeer(value class Java.Interop.JniObjectReferen    0.21%               0.2%
10. ModuleHandle.ResolveType(value class System.Runtime.CompilerServices.Q    0.17%               0.17%

RuntimeNativeMethods._monodroid_gref_log + RuntimeNativeMethods._monodroid_lref_log_delete + RuntimeNativeMethods._monodroid_lref_log_new stand out. I would not expect these to have such impact on MAUI app startup, especially the 4.4% of gref log.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssues that need to be assigned.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions