Skip to content

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Aug 15, 2025

Mono specific changes in #111598 regressed Mono runtime performance significantly. Reverting the changes for now.

Fixes #112763

Mono specific changes in dotnet#111598 regressed Mono runtime performance significantly. Reverting the changes for now.

Fixes dotnet#112763
@Copilot Copilot AI review requested due to automatic review settings August 15, 2025 07:39
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Aug 15, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR partially reverts Mono-specific changes from a previous TypeName APIs optimization that caused significant performance regressions in the Mono runtime. The revert focuses on removing the extensibleParser parameter and related logic while preserving the core TypeName API functionality.

Key changes:

  • Remove extensibleParser parameter from TypeNameResolver methods
  • Restore direct RuntimeType.GetType calls for simple overloads
  • Revert nested type resolution to use standard GetNestedType method
  • Update test expectations for Mono runtime differences

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
Type.Mono.cs Reverts GetType overloads to call RuntimeType.GetType directly for simple cases, removes extensibleParser parameter
RuntimeType.Mono.cs Restores GetNestedType method signature and removes internal ignoreAmbiguousMatch logic
TypeNameResolver.Mono.cs Removes extensibleParser field and simplifies nested type resolution logic
TypeTests.cs Updates test data to account for Mono runtime behavior differences

@jkotas jkotas added area-System.Reflection and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Aug 15, 2025
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

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

I build this branch locally (Release mode), then copied System.Private.CoreLib.dll on top of my Android runtime pack.

This seems to fix this specific performance regression on Android:

before fix: 1023.8ms
after fix: 907ms

This is pretty close to my estimate from #118747, so looks good. 👍

jonathanpeppers added a commit to dotnet/maui that referenced this pull request Aug 15, 2025
I tested this with a "franken-build", using
`System.Private.CoreLib.dll` from this PR:

* dotnet/runtime#118761

With the `Type.GetType()` revert in place for Mono, I'm getting good
startup on an Android Pixel 5 (old) device with the `dotnet new maui`
project template:

Comparing the updated AOT profile:

    Before:
    Average(ms): 624.9
    Std Err(ms): 3.77844765302719
    Std Dev(ms): 11.9485006032835
    After:
    Average(ms): 582.1
    Std Err(ms): 2.92289810519172
    Std Dev(ms): 9.24301538099625

Some of my past numbers were on a Pixel 7, so these are good numbers for
an even older device.

We may want to run this again with newer (less-franken) builds, but
this is worth merging for now.
@jkotas jkotas merged commit d1691e1 into dotnet:main Aug 15, 2025
103 of 105 checks passed
github-actions bot pushed a commit to dotnet/maui that referenced this pull request Aug 17, 2025
I tested this with a "franken-build", using
`System.Private.CoreLib.dll` from this PR:

* dotnet/runtime#118761

With the `Type.GetType()` revert in place for Mono, I'm getting good
startup on an Android Pixel 5 (old) device with the `dotnet new maui`
project template:

Comparing the updated AOT profile:

    Before:
    Average(ms): 624.9
    Std Err(ms): 3.77844765302719
    Std Dev(ms): 11.9485006032835
    After:
    Average(ms): 582.1
    Std Err(ms): 2.92289810519172
    Std Dev(ms): 9.24301538099625

Some of my past numbers were on a Pixel 7, so these are good numbers for
an even older device.

We may want to run this again with newer (less-franken) builds, but
this is worth merging for now.
rmarinho pushed a commit to dotnet/maui that referenced this pull request Aug 18, 2025
I tested this with a "franken-build", using
`System.Private.CoreLib.dll` from this PR:

* dotnet/runtime#118761

With the `Type.GetType()` revert in place for Mono, I'm getting good
startup on an Android Pixel 5 (old) device with the `dotnet new maui`
project template:

Comparing the updated AOT profile:

    Before:
    Average(ms): 624.9
    Std Err(ms): 3.77844765302719
    Std Dev(ms): 11.9485006032835
    After:
    Average(ms): 582.1
    Std Err(ms): 2.92289810519172
    Std Dev(ms): 9.24301538099625

Some of my past numbers were on a Pixel 7, so these are good numbers for
an even older device.

We may want to run this again with newer (less-franken) builds, but
this is worth merging for now.
@jkotas jkotas deleted the typename-parsing-perf branch August 27, 2025 00:46
@github-actions github-actions bot locked and limited conversation to collaborators Sep 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Perf][mono] GetType_[Non]FullyQualifiedNames regressions on 2/10/2025 10:18:46 PM
3 participants