flutter_flutter/docs/engine/Engine-disk-footprint.md
gaaclarke 6baea94c1c
updates docs for flutter engine footprint (#176217)
## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-10-06 17:50:20 +00:00

67 lines
3.2 KiB
Markdown

# Engine disk footprint
Here are all the tools to help track and debug the disk size of the Flutter
engine.
## Treemaps
For each commit to [flutter/flutter](https://github.com/flutter/flutter) the
Chromebots generate treemaps illustrating the sizes of the individual components
within release builds of `libflutter.so`. The treemap is uploaded to Google
Cloud Storage and linked from the
[LUCI](https://ci.chromium.org/p/flutter/g/engine/console) console.
To find a treemap for a given commit follow these steps:
1) go to the list of all flutter commits:
<https://github.com/flutter/flutter/commits/main/>
1) find the commit you want to evaluate, then click on the green checkbox to see
the checks
1) find the check titled `Linux linux_android_aot_engine`, click on `details`
1) Click on `View more details on flutter-dashboard` to get access to the LUCI
build page (example:
<https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20linux_android_aot_engine/17969/overview>).
1) expand the section called `launch builds`
1) find the launched build named something like `Linux Production Engine Drone
for ci/android_release_arm64`, click it (example
<https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20Production%20Engine%20Drone/1294317/overview>).
1) look for the build section called `log links`, click the `index.html` link
under it (example:
<https://storage.googleapis.com/flutter_logs/engine/96fe3b3df509d451116124f0abbd288e36a03805/builder/ff60e5a3-b415-42ae-a7b4-025b1af8ec71/index.html>).
Treemaps can also be generated locally with the following call:
```shell
flutter/ci/binary_size_treemap.sh <path/to/libflutter.so> <output_directory>
```
## Benchmarks
In [devicelab](https://github.com/flutter/flutter/tree/main/dev/devicelab) we
run various benchmarks to track the APK/IPA sizes and various (engine) artifacts
contained within. These benchmarks run for every commit to
[flutter/flutter](https://github.com/flutter/flutter) and are visible on our
[build dashboard](https://flutter-dashboard.appspot.com/). The most relevant
benchmarks for engine size are:
* APK/IPA size of Flutter Gallery
* Android: `flutter_gallery_android__compile/release_size_bytes`
* iOS: `flutter_gallery_ios__compile/release_size_bytes`
* APK/IPA size of minimal hello_world app
* Android: `hello_world_android__compile/release_size_bytes`
* iOS: `hello_world_ios__compile/release_size_bytes`
* Size of bundled `icudtl.dat`
* Compressed in APK: `hello_world_android__compile/icudtl_compressed_bytes`
* Uncompressed: `hello_world_android__compile/icudtl_uncompressed_bytes`
* Size of bundled `libflutter.so` (release mode)
* Compressed in APK: `hello_world_android__compile/libflutter_compressed_bytes`
* Uncompressed: `hello_world_android__compile/libflutter_uncompressed_bytes`
* Size of VM & isolate snapshots (data and instructions)
* Compressed in APK: `hello_world_android__compile/snapshot_compressed_bytes`
* Uncompressed: `hello_world_android__compile/snapshot_uncompressed_bytes`
## Comparing AOT Snapshot Sizes
A detailed comparison of AOT snapshot sizes can be performed using the
[instructions documented here](./benchmarks/Comparing-AOT-Snapshot-Sizes.md).