Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add .NET 6 support for --aot-lazy-assembly-load #6935

Closed
jonathanpeppers opened this issue Apr 18, 2022 · 0 comments · Fixed by #6940
Closed

Add .NET 6 support for --aot-lazy-assembly-load #6935

jonathanpeppers opened this issue Apr 18, 2022 · 0 comments · Fixed by #6940
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects. Area: App Runtime Issues in `libmonodroid.so`.
Milestone

Comments

@jonathanpeppers
Copy link
Member

jonathanpeppers commented Apr 18, 2022

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

.NET 6

Description

See:

We need to pass --aot-lazy-assembly-load by default for Release + AOT builds in .NET 6. We need an MSBuild property to "opt out" if needed.

We found this saves ~10ms to startup in a dotnet new maui project on a Pixel 5.

@jonathanpeppers jonathanpeppers added Area: App+Library Build Issues when building Library projects or Application projects. Area: App Runtime Issues in `libmonodroid.so`. labels Apr 18, 2022
@jonathanpeppers jonathanpeppers added this to the .NET 6 milestone Apr 18, 2022
grendello added a commit to grendello/xamarin-android that referenced this issue Apr 19, 2022
Fixes: dotnet#6935
Context: dotnet/runtime#67024

Add support for enabling lazy loading of AOTd assemblies and their
associated shared libraries, when targetting .NET6+.

The feature is enabled by default when AOT is enabled for `Release`
builds and can be disabled by setting the new
`$(AndroidAotEnableLazyLoad)` MSBuild property to `false`.
grendello added a commit to grendello/xamarin-android that referenced this issue Apr 22, 2022
Fixes: dotnet#6935
Context: dotnet/runtime#67024

Add support for enabling lazy loading of AOTd assemblies and their
associated shared libraries, when targetting .NET6+.

The feature is enabled by default when AOT is enabled for `Release`
builds and can be disabled by setting the new
`$(AndroidAotEnableLazyLoad)` MSBuild property to `false`.
grendello added a commit to grendello/xamarin-android that referenced this issue Apr 22, 2022
Fixes: dotnet#6935
Context: dotnet/runtime#67024

Add support for enabling lazy loading of AOTd assemblies and their
associated shared libraries, when targetting .NET6+.

The feature is enabled by default when AOT is enabled for `Release`
builds and can be disabled by setting the new
`$(AndroidAotEnableLazyLoad)` MSBuild property to `false`.
grendello added a commit to grendello/xamarin-android that referenced this issue Apr 25, 2022
Fixes: dotnet#6935
Context: dotnet/runtime#67024

Add support for enabling lazy loading of AOTd assemblies and their
associated shared libraries, when targetting .NET6+.

The feature is enabled by default when AOT is enabled for `Release`
builds and can be disabled by setting the new
`$(AndroidAotEnableLazyLoad)` MSBuild property to `false`.
jonpryor pushed a commit that referenced this issue Apr 25, 2022
Fixes: #6935

Context: dotnet/runtime#67024

Add support for enabling lazy loading of AOTd assemblies and their
associated shared libraries, when targeting .NET6+.

The feature is enabled by default when AOT is enabled for `Release`
builds and can be disabled by setting the new
`$(AndroidAotEnableLazyLoad)` MSBuild property to `false`.

Performance gains are obvious, but their scale depends on where we look.
Results of running a Hello World MAUI app on Pixel 6 Pro, with:

See PR for full timing details.

With:

  * `$(RuntimeIdentifier)`=android-arm64
  * `$(AndroidEnablePreloadAssemblies)`=False
  * `$(AndroidUseAssemblyStore)`=True, `$(AndroidEnableAssemblyCompression)`=True

| Scenario                              |    Before |     After |         Δ |
| ------------------------------------- | --------: | --------: | --------: |
| `ActivityTaskManager: Displayed` time |   367.800 |   368.200 |  +0.11% ✗ |
| `JNIEnv.Initialize()` time            |     6.221 |     5.367 | -13.73% ✓ |
| Total native init time                |    39.047 |    20.395 | -47.77% ✓ |

With:

  * `$(RuntimeIdentifier)`=android-arm
  * `$(AndroidEnablePreloadAssemblies)`=True
  * `$(AndroidUseAssemblyStore)`=True, `$(AndroidEnableAssemblyCompression)`=True

| Scenario                              |    Before |     After |         Δ |
| ------------------------------------- | --------: | --------: | --------: |
| `ActivityTaskManager: Displayed` time |   490.600 |   475.000 |  -3.18% ✓ |
| `JNIEnv.Initialize()` time            |     8.602 |     7.787 |  -9.48% ✓ |
| Total native init time                |    47.726 |    27.156 | -43.10% ✓ |
jonathanpeppers pushed a commit to jonathanpeppers/xamarin-android that referenced this issue Apr 25, 2022
Backports: dotnet#6940
Fixes: dotnet#6935

Context: dotnet/runtime#67024

Add support for enabling lazy loading of AOTd assemblies and their
associated shared libraries, when targeting .NET6+.

The feature is enabled by default when AOT is enabled for `Release`
builds and can be disabled by setting the new
`$(AndroidAotEnableLazyLoad)` MSBuild property to `false`.

Performance gains are obvious, but their scale depends on where we look.
Results of running a Hello World MAUI app on Pixel 6 Pro, with:

See PR for full timing details.

With:

  * `$(RuntimeIdentifier)`=android-arm64
  * `$(AndroidEnablePreloadAssemblies)`=False
  * `$(AndroidUseAssemblyStore)`=True, `$(AndroidEnableAssemblyCompression)`=True

| Scenario                              |    Before |     After |         Δ |
| ------------------------------------- | --------: | --------: | --------: |
| `ActivityTaskManager: Displayed` time |   367.800 |   368.200 |  +0.11% ✗ |
| `JNIEnv.Initialize()` time            |     6.221 |     5.367 | -13.73% ✓ |
| Total native init time                |    39.047 |    20.395 | -47.77% ✓ |

With:

  * `$(RuntimeIdentifier)`=android-arm
  * `$(AndroidEnablePreloadAssemblies)`=True
  * `$(AndroidUseAssemblyStore)`=True, `$(AndroidEnableAssemblyCompression)`=True

| Scenario                              |    Before |     After |         Δ |
| ------------------------------------- | --------: | --------: | --------: |
| `ActivityTaskManager: Displayed` time |   490.600 |   475.000 |  -3.18% ✓ |
| `JNIEnv.Initialize()` time            |     8.602 |     7.787 |  -9.48% ✓ |
| Total native init time                |    47.726 |    27.156 | -43.10% ✓ |
jonathanpeppers added a commit that referenced this issue Apr 26, 2022
Backports: #6940
Fixes: #6935

Context: dotnet/runtime#67024

Add support for enabling lazy loading of AOTd assemblies and their
associated shared libraries, when targeting .NET6+.

The feature is enabled by default when AOT is enabled for `Release`
builds and can be disabled by setting the new
`$(AndroidAotEnableLazyLoad)` MSBuild property to `false`.

Performance gains are obvious, but their scale depends on where we look.
Results of running a Hello World MAUI app on Pixel 6 Pro, with:

See PR for full timing details.

With:

  * `$(RuntimeIdentifier)`=android-arm64
  * `$(AndroidEnablePreloadAssemblies)`=False
  * `$(AndroidUseAssemblyStore)`=True, `$(AndroidEnableAssemblyCompression)`=True

| Scenario                              |    Before |     After |         Δ |
| ------------------------------------- | --------: | --------: | --------: |
| `ActivityTaskManager: Displayed` time |   367.800 |   368.200 |  +0.11% ✗ |
| `JNIEnv.Initialize()` time            |     6.221 |     5.367 | -13.73% ✓ |
| Total native init time                |    39.047 |    20.395 | -47.77% ✓ |

With:

  * `$(RuntimeIdentifier)`=android-arm
  * `$(AndroidEnablePreloadAssemblies)`=True
  * `$(AndroidUseAssemblyStore)`=True, `$(AndroidEnableAssemblyCompression)`=True

| Scenario                              |    Before |     After |         Δ |
| ------------------------------------- | --------: | --------: | --------: |
| `ActivityTaskManager: Displayed` time |   490.600 |   475.000 |  -3.18% ✓ |
| `JNIEnv.Initialize()` time            |     8.602 |     7.787 |  -9.48% ✓ |
| Total native init time                |    47.726 |    27.156 | -43.10% ✓ |

Co-authored-by: Marek Habersack <grendel@twistedcode.net>
@ghost ghost locked as resolved and limited conversation to collaborators Jun 2, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Area: App+Library Build Issues when building Library projects or Application projects. Area: App Runtime Issues in `libmonodroid.so`.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants