Skip to content
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

Investigate enabling MSR as the new default registrar #19769

Closed
ivanpovazan opened this issue Jan 9, 2024 · 1 comment
Closed

Investigate enabling MSR as the new default registrar #19769

ivanpovazan opened this issue Jan 9, 2024 · 1 comment
Assignees
Labels
enhancement The issue or pull request is an enhancement
Milestone

Comments

@ivanpovazan
Copy link
Contributor

A new variant of static registrar has been implemented: https://github.com/xamarin/xamarin-macios/blob/main/docs/managed-static-registrar.md to support NativeAOT runtime.

However, since the new managed variant shows significant performance improvements for simple method signatures on macOS and MacCatalyst, we should investigate enabling it as the new default registrar and measure the size and performance impact of such change for all supported runtimes as well.

@ivanpovazan ivanpovazan added the enhancement The issue or pull request is an enhancement label Jan 9, 2024
@ivanpovazan ivanpovazan added this to the .NET 9 milestone Jan 9, 2024
@ivanpovazan ivanpovazan self-assigned this Jan 9, 2024
rolfbjarne pushed a commit that referenced this issue Mar 4, 2024
### Description

This PR sets the default registrar to be `managed-static` for the following platforms and build configurations:

- `ios` and `tvos` device builds in `Debug` and `Release` configurations
- `macOS` and `MacCatalyst` builds in `Release` configuration

This is accomplished by moving the registrar selection logic from custom linker steps (dotnet-linker) into the SDK.

Legacy code still has appropriate `SelectRegistrar` methods.

### App size implications

Using managed-static registrar increases the `dotnet new maui` app on
iOS by `~2-3%`.

Tested with dotnet `9.0.100-preview.2.24119.3`

| dotnet new maui (LinkMode=SdkOnly) | static | managed-static | diff (%) |
|------------------------------------|--------|----------------|----------|
| Size on disk (MB)                  | 39,20  | 40,29          | 2,79%    |
| Size zipped (MB)                   | 14,52  | 14,80          | 1,92%    |

| dotnet new maui (LinkMode=Full) | static | managed-static | diff (%) |
|-----------------------------------|---------|----------------|----------|
| Size on disk (MB)                 | 29,93   | 30,88          | 3,18%    |
| Size zipped (MB)                  | 11,20   | 11,47          | 2,37%    |

We talked about the size increase, and we're tentatively trying to enable by default anyways (since the managed static registrar is typically faster), but documenting what we're doing.

---
Fixes #19769
@ivanpovazan
Copy link
Contributor Author

Added a description here: https://github.com/xamarin/xamarin-macios/wiki/.NET-9-release-notes#type-registrar-managed-static-as-the-new-default
@rolfbjarne please let me know if the text needs to be altered.

Closing as completed via: 94646db

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue or pull request is an enhancement
Projects
Status: Done
Development

No branches or pull requests

1 participant