Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Figure out how to make Android library footprint size smaller #613

Open
fluffyemily opened this issue Apr 3, 2018 · 1 comment
Open
Labels
A-build A-design Planning and overall architecture. A-ffi

Comments

@fluffyemily
Copy link
Contributor

Currently (13/3/2018) the Android app footprint size is huge (70mb). We need to ensure that we can build Android apps with a sensible footprint. This ticket tracks discovering build options and streamlining our imports to reduce our release Android library size.

@rnewman rnewman changed the title Figure out how to make Androids footprint size smaller. Figure out how to make Android library footprint size smaller Apr 3, 2018
@fluffyemily fluffyemily added A-build A-design Planning and overall architecture. A-ffi labels May 15, 2018
@grigoryk
Copy link
Contributor

It's certainly not 70mb, but it appears that judging how large of an impact pulling in the library will have is a little tricky.

FWIW, the *aar file generated via #720 is 2.75mb: https://bintray.com/grisha/Mentat/mentat/0.3.1#files/org%2Fmozilla%2Fmentat%2Fmentat%2F0.3.1 - which is still almost 3x larger than we'd like!

We talked about this in Slack.

@rnewman [6:07 PM] Part of the problem is lack of tree shaking to eliminate code when built in certain ways, which makes accurate measurement difficult. Another part is lots of string literals, lots of dependencies, etc.
Tolstoy pulls in Hyper and stuff.
In theory Rust release builds with Rust entry points (I.e., using Mentat from a Rust app) will prune all of the unreachable code — e.g. if you don’t use the query builder, it’s not present in the binary.
grisha [6:34 PM]
right, but that wouldn't help us with mentat_ffi iiuc? since that touches most everything in mentat
rnewman [6:37 PM]
Correct. You’d need to make dead code pruning occur at the final link stage. I believe Bitcode does this.
The point is: you can’t tell how much of an impact Mentat would have on APK size just by looking at libmentat.a.
Nor can you judge based on mentat_cli.
rnewman [6:48 PM]
I believe you can configure the Android SDK and NDK to use LTO: android/ndk#313

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-build A-design Planning and overall architecture. A-ffi
Projects
None yet
Development

No branches or pull requests

2 participants