Skip to content

Commit e7b3d29

Browse files
mkustermanncommit-bot@chromium.org
authored andcommitted
[vm/doc] Add documentation describing AOT code size analysis
This adds runtime/docs/aot_binary_size_analysis.md describing how to visualize the breakdown of generated code size from our AOT. Change-Id: I63ae3728db808532fad0ca178e1947e5b8280521 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112397 Reviewed-by: Michael Thomsen <[email protected]> Commit-Queue: Martin Kustermann <[email protected]>
1 parent 9adf3c1 commit e7b3d29

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# AOT code size analysis
2+
3+
The Dart VM's AOT compiler has support for emitting binary size information
4+
for all the code that gets generated. This information can then be visualized.
5+
6+
## Telling the AOT compiler to generate binary size information
7+
8+
Our AOT compiler accepts an extra `--print-instructions-sizes-to=sizes.json`
9+
flag. If supplied the AOT compiler will emit binary size information for all
10+
generated functions to `sizes.json`.
11+
12+
This flag can be passed to `gen_snapshot` directly, or to the various wrapper
13+
scripts (e.g. `pkg/vm/tool/precompiler2`):
14+
15+
```
16+
% tools/build.py -mrelease -ax64 runtime_kernel dart_precompiled_runtime
17+
% pkg/vm/tool/precompiler2 --print-instructions-sizes-to=hello_sizes.json hello.dart hello.dart.aot
18+
```
19+
20+
## Visualizing the information from the binary size json file
21+
22+
To visualize the information emitted by the AOT compiler one can use our binary
23+
size analysis tool:
24+
25+
```
26+
% dart pkg/vm/bin/run_binary_size_analysis.dart hello_sizes.json hello_sizes
27+
Generated file:///.../sdk/hello_sizes/index.html
28+
% chrome hello_sizes/index.html
29+
```
30+

0 commit comments

Comments
 (0)