Bug 35834 - AOT + LLVM result in enormous APK
Summary: AOT + LLVM result in enormous APK
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 6.0.99
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2015-11-13 07:45 UTC by Przemysław Raciborski
Modified: 2015-11-23 17:28 UTC (History)
5 users (show)

Tags: BZCU
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 Przemysław Raciborski 2015-11-13 07:45:30 UTC
Is it normal that APK without AOT has ~30mb size and generated APK with AOT + LLVM size is ~80 mb?
I use multidex - my app uses a lot of external libraries google play, facebook sdk and so on..
Comment 1 Jonathan Pryor 2015-11-23 17:28:38 UTC
> Is it normal that APK without AOT has ~30mb size and generated APK with AOT +
> LLVM size is ~80 mb?

Yes.

At present, we don't have any IL stripping support, for enabling AOT is purely *additive* to previous .apk sizes, meaning your existing 30MB app w/o AOT will continue to be *at least* 30MB with AOT enabled. That 30MB is your floor.

Next, for *each* ABI that your app supports -- armeabi-v7a, x86, etc. -- every assembly that your app contains is AOT'd, and AOT'ing an assembly frequently results in a *larger* file than the source assembly. So you're *at least doubling* the "instruction" size (IL + machine code), and that's if your .apk only supports a single ABI.

Additionally, when it comes to generics AOT will need to emit expansions for every known instantiation, which can *really* cause machine code size to bloat.

AOT is for performance (reduced JIT times), *not* for app sizes.