Reputation: 197
I'm using Monotouch to create iOS apps. I've created bindings for ChartBoost, RevMob and others.
The problem that I'm having is that the final app has a size of about 20MB. This is way too much for such a simple game app.
I've checked the main app projects dll and it is only about 500KB large. But the binding dlls are altogether about 19MB.
I'm not sure what I'm doing wrong I've already done the following things but with no luck: - Link native SDKs only - Use only ARMV7 - Use LLVM - Added LinkerSafe attribute to my Binding projects.
Can anyone help me out?
Upvotes: 1
Views: 846
Reputation: 43553
Your settings sounds sane - but there not many details in your question that we can use to help you. If you use several native libraries then it's not surprising to get large applications.
Note that Link native SDKs only does not exists. It's Link SDK assemblies only and it applies only to managed assemblies (not native). Still managed linking is very important as it will allow further optimizations to be possible.
When you add [LinkerSafe]
in your binding project then the unused code will be removed (even if Link SDK is used). It also does quite a bit of optimizations on the generated binding code (making it smaller and faster). Make sure (compare before and after sizes) that the bindings assemblies includes the attribute.
You might want to use Link all assemblies to get the maximum savings. Again compare the before (link sdk) and after (link all) to see what were the gains (you might have to [Preserve]
some of your code to make this work, e.g. if you use reflection).
There is a very new feature, SmartLink
, which remove the --force_load
requirement that will make it easier to remove native code (e.g. from most native libraries). It's hard to predict savings (not enough data) but a lot of binding samples (on github) saved between 250KB to 400KB.
Note: I'll update my answer once the video of my Evolve talk (about build optimizations) is available online. In the mean time there's quite a few older blog post I did (and other documents) that can help you optimize the size of your applications.
Upvotes: 4