envoyproxy / envoy-mobile

Client HTTP and networking library based on the Envoy project for iOS, Android, and more.
https://envoymobile.io
Apache License 2.0
560 stars 84 forks source link

android: re-run binary size analysis #742

Open rebello95 opened 4 years ago

rebello95 commented 4 years ago

We added an iOS-specific binary size analysis to our documentation in https://github.com/lyft/envoy-mobile/pull/743, and should do the same for Android.

buildbreaker commented 4 years ago

I've done a quick binary comparison between a static vs dynamic library here: https://github.com/lyft/envoy-mobile/pull/747

I've commented in the PR but I'll repeat the comment here for better visibility:

Worked with @keith on this a bit today

With the current state in this PR/branch, these are the steps which I've used to build an iOS app with a dynamic library:

  1. bazel run //examples/swift/hello_world:app --config=ios
  2. cp bazel-bin/examples/swift/hello_world/app.ipa ~/tmp/dynamic.ipa
  3. unzip dynamic.ipa dynamic

To get a static library/app comparison:

  1. git checkout 917186e6cd080880106b9b2e0bf06d741bbb800e (This is the static library hash prior to the changes here)
  2. bazel run //examples/swift/hello_world:app --config=ios
  3. cp bazel-bin/examples/swift/hello_world/app.ipa ~/tmp/static.ipa

Observations: The dynamic library app is 152.1MB large The static library app is 39.3MB large

By inspecting the unzipped internals, the dynamic/app.app/Frameworks/dynamic.framework/dynamic is size 135MB

Using strip naively (strip -no_code_signature_warning -xXNT dynamic/app.app/Frameworks/dynamic.framework/dynamic), we could get this file down to 65MB

rebello95 commented 4 years ago

Thanks @buildbreaker! This issue referenced the documentation changes on iOS in https://github.com/lyft/envoy-mobile/pull/743 - would we be able to update Android docs as well?

yschimke commented 2 years ago

Curious, but not directly impacted.

Are these still roughly the current numbers? Why the 10x against iOS? Is there a wishful target you think you will get to? It's too big for almost all 3rd party apps at 40MB.

jpsim commented 2 years ago

I'll look into getting up to date numbers on iOS & Android for you, but in my last test for iOS in October, Envoy Mobile added 5-6MB to our App Store app sizes. Measuring the size of the output framework on iOS isn't a good indicator of the impact on App Store sizes because of debug symbols, linker dead code stripping and app thinning.

yschimke commented 2 years ago

Yep - that's good enough to answer my curiosity. Thanks.

jpsim commented 2 years ago

I just measured iOS again, and the numbers haven't changed since October. Envoy Mobile adds 5MB to the App Store decompressed app size.