Bug 47048 - RegisterTypeUnsafe reflects on immutable metadata during app startup
Summary: RegisterTypeUnsafe reflects on immutable metadata during app startup
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 10.2 (iOS 10.1)
Hardware: PC Windows
: --- enhancement
Target Milestone: 15.3
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2016-11-15 20:32 UTC by Jerome Laban
Modified: 2017-05-05 08:08 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Jerome Laban 2016-11-15 20:32:55 UTC
The dynamic registrar inspects (via RegisterTypeUnsafe) the whole app domain's types, interfaces and methods to find register-able NSObject inheriting types.

In a complex app, this processing can roughly 10% of the startup time.

Given that the package's content never changes, the build process should be able to provide a pre-computed table to the dynamic registrar, for types known at compile time.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2016-11-16 06:06:06 UTC
This is already on the map.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2017-05-05 07:52:49 UTC
There's a static registrar that does exactly what you're requesting.

You can select the static registrar by adding "--registrar:static" to the additional mtouch arguments in the project's iOS Build options.

The static registrar is the default for device builds, but not for simulator builds (using the static registrar makes the build longer; for the simulator the added build time is usually longer than the gained startup time, while for the device it's the opposite).

Some time ago we added an intermediate mode: we pre-compute (run the static registrar) for only Xamarin.iOS.dll, then we ship this information, and use this pre-computed information for simulator builds when we can. This speeds up the launch time in the simulator significantly, since we only need to process any user assemblies at runtime (in any case you can always manually select the static registrar anyway).