-
Notifications
You must be signed in to change notification settings - Fork 538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable lazy loading of AOTd assemblies #6940
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were you able to time the difference?
Yep, I will time it in a few, want to fix the test failures first |
Unfortunately, enabling the feature for 64-bit targets results in this Mono runtime abort:
|
@lambdageek @vargaz ideas about the issue above? Should we just file an issue on dotnet/runtime? |
@jonathanpeppers I already talked to @vargaz, we'll continue tomorrow :) |
Please don't merge until #6946 is in and I can rebase this PR on it |
9c2d44d
to
37125ef
Compare
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`.
37125ef
to
0c32643
Compare
Fixes: https://github.com/xamarin/xamarin-android/issues/6935
Context: https://github.com/dotnet/runtime/pull/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% ✓ | |
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% ✓ |
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 <[email protected]>
Fixes: #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 tofalse
.Performance gains are obvious, but their scale depends on where we look.
Results of running a Hello World MAUI app on Pixel 6 Pro:
Displayed time:
Just the
JNIEnv.Initialize
call during native init:Total time taken by the native init (before handing control over to the managed
land):