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

[Android]: Report SDK size as a comment in PRs #1303

Open
7 of 11 tasks
bruno-garcia opened this issue Mar 3, 2021 · 10 comments
Open
7 of 11 tasks

[Android]: Report SDK size as a comment in PRs #1303

bruno-garcia opened this issue Mar 3, 2021 · 10 comments

Comments

@bruno-garcia
Copy link
Member

bruno-garcia commented Mar 3, 2021

We'd like to start managing the bundle size of the SDK more actively.

For that, we'd like to start taking some numbers during PRs, and with the end goal of posting as a PR comment the bundle size and a diff to main.

Approaches considered and characteristics of them:

Measuring the aar

  • Either we do a naive measurement solely of our package without considering dependencies. Or we need to recursively find all dependencies and measure their sizes.
  • There are multiple slices on each aar, for each abi.
    • We'd need to compile for a specific one, or peek into the aar to calculate specific architectures.

Measuring the final app

  • We can run proguard on the sample app which has heavy use of our features and measure more realistically the "overhead" in bundle size.

Suggested Phases:

@romtsn
Copy link
Member

romtsn commented Mar 14, 2022

Some inspiration: firebase/firebase-android-sdk#3011 (comment)

@philipphofmann
Copy link
Member

Worth noting that our JavaScript repo already has something like this, see getsentry/sentry-javascript#4993 (comment).

@marandaneto
Copy link
Contributor

Somehow related #1411

@philipphofmann
Copy link
Member

We could use https://github.com/JakeWharton/diffuse

Diffuse is a tool for diffing APKs, AABs, AARs, and JARs in a way that aims to provide both a high-level view of what changes along with important detailed output.

@philipphofmann
Copy link
Member

philipphofmann commented Apr 27, 2022

The first goal would be to get the output of diffuse and just add it as a comment to the PR.

Example output of diffuse:

          │          compressed           │          uncompressed
          ├───────────┬───────────┬───────┼───────────┬───────────┬────────
 APK      │ old       │ new       │ diff  │ old       │ new       │ diff
──────────┼───────────┼───────────┼───────┼───────────┼───────────┼────────
      dex │ 664.8 KiB │ 664.8 KiB │ -25 B │   1.5 MiB │   1.5 MiB │ -112 B
     arsc │ 201.7 KiB │ 201.7 KiB │   0 B │ 201.6 KiB │ 201.6 KiB │    0 B
 manifest │   1.4 KiB │   1.4 KiB │   0 B │   4.2 KiB │   4.2 KiB │    0 B
      res │ 418.2 KiB │ 418.2 KiB │ -14 B │ 488.3 KiB │ 488.3 KiB │    0 B
    asset │       0 B │       0 B │   0 B │       0 B │       0 B │    0 B
    other │  37.1 KiB │  37.1 KiB │   0 B │  36.3 KiB │  36.3 KiB │    0 B
──────────┼───────────┼───────────┼───────┼───────────┼───────────┼────────
    total │   1.3 MiB │   1.3 MiB │ -39 B │   2.2 MiB │   2.2 MiB │ -112 B

@marandaneto
Copy link
Contributor

We could also give it a try with https://github.com/Tencent/matrix/tree/master/matrix/matrix-android/matrix-apk-canary

Analyse the APK package, give suggestions of reducing the APK's size; Compare two APK and find out the most significant increment on size

@romtsn
Copy link
Member

romtsn commented Jan 31, 2023

diffuse github action https://github.com/usefulness/diffuse-action

@markushi
Copy link
Member

markushi commented Feb 1, 2023

Here's the relevant github action which already does an APK size diff: https://github.com/getsentry/action-app-sdk-overhead-metrics

@bruno-garcia
Copy link
Member Author

I thought @vaind added this here, no?

@romtsn
Copy link
Member

romtsn commented Feb 24, 2023

not the breakdown of what changed, just the raw apk size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

6 participants