Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Base class library size on disk footprint workitems #5013
I spent some time looking into why an optimized Hello World is 3.8 MB big on Windows. There are two ways to look at this problem: what we do in the compiler to make it this big, and what we do in the class libraries that forces it to be so big. This issue tracks the latter.
With a set of hacks here Hello World can go down to about 2.4 MB. I was focusing mostly on getting the reflection stack out of the binary.
There are also some other opportunities I didn't measure yet:
Are you trying to get rid of dependency on native metadata completely? I would think that saving the backing data for enums in the native metadata should be fine. Maybe the real problem here is that there is too much code required to fetch the enum values and names from native metadata.
These maybe candidates for readonly-value overrides implemented by Mono AOT: https://github.com/mono/mono/blob/50fa04c1365f68f309c6d0613c96672deb0d07fc/man/mono.1#L274 . The basic idea is that you place the call to the code you want to exclude behind a property and you tell the compiler what this property is going to return. It would be nice to do this optimization in IL Linker as an optional pass since it is generally applicable. Though this one is low-level and policy-free enough that we can live with it in the ILCompiler too.
For globalization, we should base it on https://github.com/dotnet/corefx/blob/master/Documentation/architecture/globalization-invariant-mode.md. (It did not existed when the Dummy globalization was added.)
I would be nice to have an option to replace the localizable error strings with hardcoded single language messages; or no errors strings at all. Again, it would be nice to do this as optional pass in ILLinker.
It should be fetched from EEType when we have one.
This. To do a
This is in a code path where all we have is a