Commit 2398faf4 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Normalize dex compression ratio in normalized_apk_size

This was causing some changes that reduce size to show as increasing
normalized size (and vice versa).

Binary-Size: Metrics change
Bug: 979205
Change-Id: I90219b7cf454f91dc64474c07caaf0ca0edcbf13
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1811517
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarEric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697770}
parent 9d96669d
...@@ -441,6 +441,11 @@ def _DoApkAnalysis(apk_filename, apks_path, tool_prefix, out_dir, report_func): ...@@ -441,6 +441,11 @@ def _DoApkAnalysis(apk_filename, apks_path, tool_prefix, out_dir, report_func):
# file size. Also gets rid of compression. # file size. Also gets rid of compression.
normalized_apk_size -= native_code.ComputeZippedSize() normalized_apk_size -= native_code.ComputeZippedSize()
normalized_apk_size += native_code_unaligned_size normalized_apk_size += native_code_unaligned_size
# Normalized dex size: Size within the zip + size on disk for Android Go
# devices running Android O (which ~= uncompressed dex size).
# Use a constant compression factor to account for fluctuations.
normalized_apk_size -= java_code.ComputeZippedSize()
normalized_apk_size += int(java_code.ComputeUncompressedSize() * 1.5)
# Unaligned size should be ~= uncompressed size or something is wrong. # Unaligned size should be ~= uncompressed size or something is wrong.
# As of now, padding_fraction ~= .007 # As of now, padding_fraction ~= .007
padding_fraction = -_PercentageDifference( padding_fraction = -_PercentageDifference(
...@@ -450,9 +455,6 @@ def _DoApkAnalysis(apk_filename, apks_path, tool_prefix, out_dir, report_func): ...@@ -450,9 +455,6 @@ def _DoApkAnalysis(apk_filename, apks_path, tool_prefix, out_dir, report_func):
padding_fraction, native_code.ComputeUncompressedSize(), padding_fraction, native_code.ComputeUncompressedSize(),
native_code_unaligned_size)) native_code_unaligned_size))
# Normalized dex size: size within the zip + size on disk for Android Go
# devices (which ~= uncompressed dex size).
normalized_apk_size += java_code.ComputeUncompressedSize()
if apks_path: if apks_path:
# Locale normalization not needed when measuring only one locale. # Locale normalization not needed when measuring only one locale.
# E.g. a change that adds 300 chars of unstranslated strings would cause the # E.g. a change that adds 300 chars of unstranslated strings would cause the
......
...@@ -37,9 +37,10 @@ For Googlers, more information available at [go/chrome-apk-size](https://goto.go ...@@ -37,9 +37,10 @@ For Googlers, more information available at [go/chrome-apk-size](https://goto.go
* Computed as: * Computed as:
* The size of an APK * The size of an APK
* With all native code as the sum of section sizes (except .bss), uncompressed. * With all native code as the sum of section sizes (except .bss), uncompressed.
* With all dex code as if it were stored compressed and also extracted. * With all dex code counted as `uncompressed_size * 1.5` (meant to simulate Android Go on Oreo).
* With all translations as if they were not missing (estimates size of missing translations based on size of english strings). * With all translations as if they were not missing (estimates size of missing translations based on size of english strings).
* Without translation-normalization, translation dumps cause jumps. * Without translation-normalization, translation dumps cause jumps.
* Translation-normalization applies only to apks (not to Android App Bundles).
### Native Code Size Metrics ### Native Code Size Metrics
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment