Skip to content

Conversation

@jonathanpeppers
Copy link
Member

I noticed there might be a performance regression in .NET 7 when
building a .NET MAUI project, in the <GenerateJavaStubs/> MSBuild
task:

.NET 6:  GenerateJavaStubs = 799 ms
xa main: GenerateJavaStubs = 912 ms

When reviewing what PerfView shows, I saw:

54.31ms (5.7%) module java.interop.tools.javacallablewrappers <<java.interop.tools.javacallablewrappers!Java.Interop.Tools.TypeNameMappings.JavaNativeTypeManager.ToJniName(class Mono.Cecil.TypeDefinition)>>

This was the overload that did not take in a TypeDefinitionCache. I
found one instance of this in <GenerateJavaStubs/>.

This doesn't seem like the .NET 7 regression, because it has always
been this way.

However, it seems to help quite a bit:

GenerateJavaStubs = 825 ms
GenerateJavaStubs = 867 ms

This probably saves around ~50ms in this task.

I noticed there might be a performance regression in .NET 7 when
building a .NET MAUI project, in the `<GenerateJavaStubs/>` MSBuild
task:

    .NET 6:  GenerateJavaStubs = 799 ms
    xa main: GenerateJavaStubs = 912 ms

When reviewing what PerfView shows, I saw:

    54.31ms (5.7%) module java.interop.tools.javacallablewrappers <<java.interop.tools.javacallablewrappers!Java.Interop.Tools.TypeNameMappings.JavaNativeTypeManager.ToJniName(class Mono.Cecil.TypeDefinition)>>

This was the overload that did not take in a `TypeDefinitionCache`. I
found one instance of this in `<GenerateJavaStubs/>`.

This doesn't seem like the .NET 7 regression, because it has always
been this way.

However, it seems to help quite a bit:

    GenerateJavaStubs = 825 ms
    GenerateJavaStubs = 867 ms

This probably saves around ~50ms in this task.
@jonpryor jonpryor merged commit c3f00cd into dotnet:main Jul 27, 2022
@jonathanpeppers jonathanpeppers deleted the GenerateJavaStubsToJniName branch July 27, 2022 18:45
grendello added a commit to grendello/xamarin-android that referenced this pull request Aug 1, 2022
* main:
  LEGO: Merge pull request 7221
  LEGO: Merge pull request 7219
  [Xamarin.Android.Build.Tasks] use `ToJniName(type, cache)` (dotnet#7211)
  [docs] Synchronize with MicrosoftDocs/xamarin-docs (dotnet#7208)
  [Mono.Android] Remove System.Linq usage (dotnet#7210)
  Bump to Android NDK r25 (dotnet#6764)
  Bump to mono/opentk@daa9b2d5 (dotnet#7192)
  [Mono.Android] Optional NTLMv2 support in AndroidMessageHandler (dotnet#6999)
  Bump to dotnet/installer@53587f9 7.0.100-rc.1.22374.1 (dotnet#7198)
grendello added a commit to grendello/xamarin-android that referenced this pull request Aug 1, 2022
* mm-codegen:
  LEGO: Merge pull request 7221
  LEGO: Merge pull request 7219
  [Xamarin.Android.Build.Tasks] use `ToJniName(type, cache)` (dotnet#7211)
  [docs] Synchronize with MicrosoftDocs/xamarin-docs (dotnet#7208)
  [Mono.Android] Remove System.Linq usage (dotnet#7210)
  Bump to Android NDK r25 (dotnet#6764)
  Bump to mono/opentk@daa9b2d5 (dotnet#7192)
  [Mono.Android] Optional NTLMv2 support in AndroidMessageHandler (dotnet#6999)
  Bump to dotnet/installer@53587f9 7.0.100-rc.1.22374.1 (dotnet#7198)
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants