-
Notifications
You must be signed in to change notification settings - Fork 532
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] feature switch defaults for fast startup (
#8347) Context: dotnet/runtime@fecf3ee Context: dotnet/runtime@3aeefbd Context: dotnet/runtime#89880 In dotnet/runtime two new feature switches were added in order to improve startup performance on Android: * `System.Diagnostics.Metrics.Meter.IsSupported`: disables `System.Diagnostics.Metrics` support for `HttpClient`, etc. * `Microsoft.Extensions.DependencyInjection.DisableDynamicEngine`: after the second call to retrieve a service from a dependency injection container, `System.Reflection.Emit` is used to improve performance of repeated calls. We also have the existing switch: * `Switch.System.Reflection.ForceInterpretedInvoke`: after the second call to `MethodInfo.Invoke()` or `ConstructorInfo.Invoke()`, `System.Reflection.Emit` is used to improve performance of repeated calls. Introduce two new MSBuild properties: * `$(AndroidAvoidEmitForPerformance)` to toggle both `Microsoft.Extensions.DependencyInjection.DisableDynamicEngine` and `Switch.System.Reflection.ForceInterpretedInvoke`. This is a public property that defaults to `true`. * `$(_SystemDiagnosticsMetricsMeterIsSupported)` to toggle `System.Diagnostics.Metrics.Meter.IsSupported`. This is a private property that defaults to `false`. I added a test to check `System.Diagnostics.Metrics.Meter.IsSupported` at runtime. I did not do this with Microsoft.Extensions, as we'd have to add a reference to the NuGet package and track its version for nightly builds. I also updated the AOT profile, and some `System.Diagnostics.Metrics.Meter` API calls are now gone: bool System.Diagnostics.Metrics.Meter:AddInstrument (System.Diagnostics.Metrics.Instrument) object System.Diagnostics.Metrics.Instrument:get_SyncObject () System.Diagnostics.Metrics.Counter`1<long> System.Diagnostics.Metrics.Meter:CreateCounter (string,string,string,System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<string, object>>) System.Diagnostics.Metrics.Counter`1<long> System.Diagnostics.Metrics.Meter:CreateCounter (string,string,string) void System.Diagnostics.Metrics.MeterListener:.cctor () void System.Diagnostics.Metrics.MetricsEventSource:.cctor () void System.Diagnostics.Metrics.MetricsEventSource:.ctor ()
- Loading branch information
1 parent
c2d0c7c
commit eb6397d
Showing
7 changed files
with
130 additions
and
93 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
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
Binary file not shown.
Oops, something went wrong.