OLD | NEW |
(Empty) | |
| 1 # How to Deal with Apk Size Alerts |
| 2 |
| 3 ### If the alert is for "other lib size" or "Unknown files size": |
| 4 * File a bug against agrieve@ to fix |
| 5 [resource_sizes.py](https://cs.chromium.org/chromium/src/build/android/resour
ce_sizes.py). |
| 6 * ...or fix it yourself. This script will output the list of unknown |
| 7 filenames. |
| 8 |
| 9 ### If the alert is a downstream size alert (aka, for Monochrome.apk): |
| 10 * The regression most likely already occurred in the upstream |
| 11 MonochromePublic.apk target. Look at the |
| 12 [upstream graphs](https://chromeperf.appspot.com/report?sid=5cfed2a07b55702fc
64255a316cdb78531e916da4e933677645bbf1fe78cf2e0&num_points=1500) |
| 13 to find the culprit & de-dupe with upstream alerts. |
| 14 * If no upstream regression was found, look through the downstream commits |
| 15 within the given date range to find the culprit. |
| 16 * Via `git log --format=fuller` (be sure to look at `CommitDate` and not |
| 17 `AuthorDate`) |
| 18 |
| 19 ### If the alert is for a roll: |
| 20 * Use a bisect to try and determine a more precise commit. |
| 21 |
| 22 ### What to do once the commit is identified: |
| 23 * If the code seems to justify the size increase: |
| 24 1. Annotate the code review with the following (replacing **bold** parts): |
| 25 > FYI - this added **20kb** to Chrome on Android. No action is required |
| 26 > (unless you can think of an obvious way to reduce the overhead). |
| 27 > |
| 28 > Link to size graph: |
| 29 [https://chromeperf.appspot.com/report?sid=6468aba6ff8d28723690042144ee893d2dd3d
ed7fb414a916520b90659b8410f&rev=**440074**](https://chromeperf.appspot.com/repor
t?sid=6468aba6ff8d28723690042144ee893d2dd3ded7fb414a916520b90659b8410f&rev=44007
4) |
| 30 2. Add an entry to |
| 31 [this spreadsheet](https://docs.google.com/spreadsheets/d/1GrRkszV7Oy5pVsa
Mb5Eb6s8izW9t4dElBxIH3iGq93o/edit#gid=1894856744) |
| 32 to document the increase (also Update the "Themes / Thoughts" tab if |
| 33 applicable). |
| 34 * If the code might not justify the size increase: |
| 35 1. File a bug and assign to the author to follow-up (and link them to this |
| 36 doc). |
| 37 2. Add an entry to |
| 38 [this spreadsheet](https://docs.google.com/spreadsheets/d/1GrRkszV7Oy5pVsa
Mb5Eb6s8izW9t4dElBxIH3iGq93o/edit#gid=1894856744) |
| 39 to document the increase. |
| 40 |
| 41 # Debugging Apk Size Increase |
| 42 |
| 43 ### How to debug apk size increase |
| 44 |
| 45 1. Figure out which file within the .apk increased by looking at the size |
| 46 graphs showing the breakdowns. |
| 47 * Refer to the chromeperf link that should have been posted to your code rev
iew |
| 48 (see above). |
| 49 * Alternatively, refer to "Apk Size" section here: |
| 50 [https://goto.google.com/clank/dashboards](https://goto.google.com/clank/d
ashboards) (*googler only*). |
| 51 1. If it's libchrome.so, build before & after and use |
| 52 [tools/binary_size/](https://cs.chromium.org/chromium/src/tools/binary_size/)
. |
| 53 * This is somewhat hand-wavy. Some notes on how this tool works at |
| 54 [crbug/482401](https://bugs.chromium.org/p/chromium/issues/detail?id=48240
1). |
| 55 1. If it's classes.dex, build before & after and use: |
| 56 [tools/android/dexdiffer/dexdiffer.py](https://cs.chromium.org/chromium/src/t
ools/android/dexdiffer/dexdiffer.py). |
| 57 * This currently just shows a list of symbols added / removed rather than |
| 58 taking into account method body sizes. |
| 59 * Enhancements to this tool tracked at |
| 60 [crbug/678044](https://bugs.chromium.org/p/chromium/issues/detail?id=67804
4). |
| 61 1. If it's images, ensure they are optimized: |
| 62 * Would it be smaller as a VectorDrawable? |
| 63 * If it's lossy, consider using webp. |
| 64 * Ensure you've optimized with |
| 65 [tools/resources/optimize-png-files.sh](https://cs.chromium.org/chromium/s
rc/tools/resources/optimize-png-files.sh). |
| 66 |
OLD | NEW |