You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reviewing `dotnet-trace` output:
dotnet trace collect --format speedscope -- C:\src\xamarin-android\bin\Release\dotnet\dotnet.exe build -bl --no-restore bar.csproj
On a `dotnet new maui` application, I noticed:
79.40ms java.interop.tools.javacallablewrappers!Java.Interop.Tools.TypeNameMappings.JavaNativeTypeManager.ToJniNameFromAttribute
This method just appears to be called *a lot*, and so things I changed:
* Check `type.HasCustomAttributes`, `attributeType.HasInterfaces`,
and `attr.HasProperties` where appropriate.
* Unroll the `System.Linq` usage one level, and use plain `foreach`
* Create a `IsIJniNameProviderAttribute` method that checks against
a list of known attribute types as a "fast path".
* The "slow path" can continue to check for the
`IJniNameProviderAttribute` interface
Other changes:
* Delete `#region`!
After these changes, I get:
51.64ms (1.2%) 0.13ns (<0.01%) java.interop.tools.javacallablewrappers!Java.Interop.Tools.TypeNameMappings.JavaNativeTypeManager.ToJniNameFromAttribute
This should save ~27ms on incremental builds of the `dotnet new maui`
project template and likely even more on larger projects.
0 commit comments