-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
In the Android prototype using TypeMapAttributes for the type mapping system, an assembly that is about 13mb (pre-trimming) is generated that includes all the generated types and TypeMapAttributes. Startup is over 2 seconds, up from ~200 ms in mono, likely due to building the typemap at startup. More perf measurements are planned this week to confirm the issue, but this is too slow, and the slowdown grows with size of the app. The previous approach in mono is close to constant speed relative to app size.
ILLink has a whole-program view like ilc, and could produce a hard-coded dictionary like ilc and the previous typemapping solution for mono.
Proposal:
We frontload the creation of an IDictionary<string, DelayedType> / IDictionary<VersionResilientTypeHash, DelayedType>, and load the type at runtime. This would remove the overhead of parsing the TypeMapAttributes at startup, and only loading would be necessary. The exact format and implementation of the dictionary is up for debate. It could be in a binary blob similar to ilc, or in IL, or something else.
Alternatives
- A lookup method that is a switch statement from string to
typeofs in IL would be fast, but requires references to the assemblies that contain the types. Adding these references to CoreLib doesn't feel right. - Split the TypeMapAttributes into their own assemblies. It could be that loading such a large assembly slows the startup significantly. However, startup time will still grow with the size of the application, and it's not clear if this will move the needle much.
cc @dotnet/illink @simonrozsival @AaronRobinsonMSFT
Metadata
Metadata
Assignees
Labels
Type
Projects
Status