-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] introduce
LlvmIrTypeCache
(#9251)
Context: https://github.com/dotnet/android/blob/main/Documentation/guides/tracing.md#how-to-dotnet-trace-a-build Making a XAML or small C# change in a .NET MAUI project and running an incremental build, shows a reasonable amount of time spent in `<GenerateJavaStubs />` -- even with a device attached. If I attach `dotnet trace` to `dotnet build`, I can see time spent in: 117.08ms (2.20%) xamarin.android.build.tasks!Xamarin.Android.Tasks.LLVMIR.MemberInfoUtilities.GetNumberFormat(class System.Reflection.MemberInfo) 82.33ms (1.60%) xamarin.android.build.tasks!Xamarin.Android.Tasks.LLVMIR.MemberInfoUtilities.IsNativePointerToPreallocatedBuffer(class System.Reflection.MemberInfo,unsigned int64&) 29.30ms (0.56%) xamarin.android.build.tasks!Xamarin.Android.Tasks.LLVMIR.MemberInfoUtilities.UsesDataProvider(class System.Reflection.MemberInfo) 17.49ms (0.33%) xamarin.android.build.tasks!Xamarin.Android.Tasks.LLVMIR.MemberInfoUtilities.PointsToSymbol(class System.Reflection.MemberInfo,class System.String&) 15.03ms (0.29%) xamarin.android.build.tasks!Xamarin.Android.Tasks.LLVMIR.MemberInfoUtilities.IsNativePointer(class System.Reflection.MemberInfo) 3.59ms (0.07%) xamarin.android.build.tasks!Xamarin.Android.Tasks.LLVMIR.MemberInfoUtilities.IsInlineArray(class System.Reflection.Membe Where all of this time is spent in `MemberInfoUtilities` doing System.Reflection to lookup members such as: [NativeAssembler (NumberFormat = LLVMIR.LlvmIrVariableNumberFormat.Hexadecimal)] public uint mono_components_mask; Introduce `LlvmIrTypeCache` to cache `NativePointerAttribute` or `NativeAssemblerAttribute` values based on `MemberInfo`. This cache will live the lifetime of a `LlvmIrComposer` instance, so future builds will not persist the cache. With these changes in place, I see a modest improvement in an incremental build with a XAML change with an attached device (1 RID): Before: Task GenerateJavaStubs 1008ms After: Task GenerateJavaStubs 872ms So, this probably improves things by about 100ms or so.
- Loading branch information
1 parent
11fe204
commit c77c22c
Showing
10 changed files
with
133 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.