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

[Xamarin.Android.Build.Tasks] fast path for <CheckClientHandlerType/> #7652

Merged

Commits on Jan 3, 2023

  1. [Xamarin.Android.Build.Tasks] fast path for <CheckClientHandlerType/>

    `dotnet trace` of a `dotnet new maui` project, I noticed this was
    happening on *any* build:
    
        65.94ms xamarin.android.build.tasks!Xamarin.Android.Tasks.CheckClientHandlerType.RunTask()
    
    Checking outside of a profiler, a `.binlog` says:
    
        CheckClientHandlerType = 55 ms
    
    This was added in 311b41e, so it is only in main & .NET 8. Maybe when
    we timed this before, it wasn't a MAUI app?
    
    Looking at the stack trace, most of the time is spent loading
    assemblies with Mono.Cecil.
    
    Let's add a check at the beginning for the two most common values:
    
    * .NET 6+: `Xamarin.Android.Net.AndroidMessageHandler`
    * Classic: `Xamarin.Android.Net.AndroidClientHandler`
    
    And we can return early in these cases.
    
    After these changes, I get:
    
        CheckClientHandlerType = 2 ms
    
    This should save ~53ms on any build w/ common settings for
    `$(AndroidHttpClientHandlerType)`.
    jonathanpeppers committed Jan 3, 2023
    Copy the full SHA
    bce18d6 View commit details
    Browse the repository at this point in the history