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

[NativeAOT] How to reduce size of published shared library? #524

Closed
Symbai opened this issue Jan 3, 2021 · 1 comment
Closed

[NativeAOT] How to reduce size of published shared library? #524

Symbai opened this issue Jan 3, 2021 · 1 comment
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation question Further information is requested

Comments

@Symbai
Copy link

Symbai commented Jan 3, 2021

I was trying out nativeAOT following this guide but I'm using a new empty .NET 5 dll project. The output size were 4.5mb for literally NO code at all.

Then I was trying to add some lines:

<PropertyGroup>
	<IlcDisableReflection>true</IlcDisableReflection>
	<RootAllApplicationAssemblies>false</RootAllApplicationAssemblies>
	<IlcGenerateCompleteTypeMetadata>false</IlcGenerateCompleteTypeMetadata>
	<IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>
	<IlcDisableUnhandledExceptionExperience>true</IlcDisableUnhandledExceptionExperience>
	<IlcOptimizationPreference>Size</IlcOptimizationPreference>
</PropertyGroup>

This reduced the size from 4.5mb to 1mb. But imagine that its an empty project, it's still waaaaay too big. With C++ or Pascal I'm within 100kb area.

Is there more I can do to reduce the size or is it expected to be 10 times larger than other AOT compilers?

@jkotas
Copy link
Member

jkotas commented Jan 3, 2021

Yes, this is what you can get in the ballpark. We do not plan to work on reducing .dlls down to 100kB as part of this experimental project.

@jkotas jkotas closed this as completed Jan 3, 2021
@jkotas jkotas added question Further information is requested area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation labels Jan 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants