OLD | NEW |
1 # Dart2js Info | 1 # Dart2js Info |
2 | 2 |
3 This package contains libraries and tools you can use to process `.info.json` | 3 This package contains libraries and tools you can use to process `.info.json` |
4 files, which are produced when running dart2js with `--dump-info`. | 4 files, which are produced when running dart2js with `--dump-info`. |
5 | 5 |
6 The `.info.json` files contain data about each element included in | 6 The `.info.json` files contain data about each element included in |
7 the output of your program. The data includes information such as: | 7 the output of your program. The data includes information such as: |
8 | 8 |
9 * the size that each function adds to the `.dart.js` output, | 9 * the size that each function adds to the `.dart.js` output, |
10 * dependencies between functions, | 10 * dependencies between functions, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 * [`library_size_split`][lib_split]: a tool that shows how much code was | 67 * [`library_size_split`][lib_split]: a tool that shows how much code was |
68 attributed to each library. This tool is configurable so it can group data | 68 attributed to each library. This tool is configurable so it can group data |
69 in many ways (e.g. to tally together all libraries that belong to a package, | 69 in many ways (e.g. to tally together all libraries that belong to a package, |
70 or all libraries that match certain name pattern). | 70 or all libraries that match certain name pattern). |
71 | 71 |
72 * [`deferred_library_check`][deferred_lib]: a tool that verifies that code | 72 * [`deferred_library_check`][deferred_lib]: a tool that verifies that code |
73 was split into deferred parts as expected. This tool takes a specification | 73 was split into deferred parts as expected. This tool takes a specification |
74 of the expected layout of code into deferred parts, and checks that the | 74 of the expected layout of code into deferred parts, and checks that the |
75 output from `dart2js` meets the specification. | 75 output from `dart2js` meets the specification. |
76 | 76 |
77 * [`deferred_library_size`][deferred_size]: a tool that gives a breakdown of | 77 * [`deferred_library_size`][deferred_size]: a tool that gives a breakdown of |
78 the sizes of the deferred parts of the program. This can show how much of | 78 the sizes of the deferred parts of the program. This can show how much of |
79 your total code size can be loaded deferred. | 79 your total code size can be loaded deferred. |
80 | 80 |
| 81 * [`deferred_library_layout`][deferred_layout]: a tool that reports which |
| 82 code is included on each output unit. |
| 83 |
81 * [`function_size_analysis`][function_analysis]: a tool that shows how much | 84 * [`function_size_analysis`][function_analysis]: a tool that shows how much |
82 code was attributed to each function. This tool also uses dependency | 85 code was attributed to each function. This tool also uses dependency |
83 information to compute dominance and reachability data. This information can | 86 information to compute dominance and reachability data. This information can |
84 sometimes help determine how much savings could come if the function was not | 87 sometimes help determine how much savings could come if the function was not |
85 included in the program. | 88 included in the program. |
86 | 89 |
87 * [`coverage_log_server`][coverage] and [`live_code_size_analysis`][live]: | 90 * [`coverage_log_server`][coverage] and [`live_code_size_analysis`][live]: |
88 dart2js has an experimental feature to gather coverage data of your | 91 dart2js has an experimental feature to gather coverage data of your |
89 application. The `coverage_log_server` can record this data, and | 92 application. The `coverage_log_server` can record this data, and |
90 `live_code_size_analysis` can correlate that with the `.info.json`, so you | 93 `live_code_size_analysis` can correlate that with the `.info.json`, so you |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 ------------------------------------------------ | 266 ------------------------------------------------ |
264 main 12345678 | 267 main 12345678 |
265 foo 7654321 | 268 foo 7654321 |
266 bar 1234567 | 269 bar 1234567 |
267 ------------------------------------------------ | 270 ------------------------------------------------ |
268 Main chunk size 12345678 | 271 Main chunk size 12345678 |
269 Deferred code size 8888888 | 272 Deferred code size 8888888 |
270 Percent of code deferred 41.86% | 273 Percent of code deferred 41.86% |
271 ``` | 274 ``` |
272 | 275 |
| 276 ### Deferred library layout tool |
| 277 |
| 278 This tool reports which code is included in each output unit. It can be run as |
| 279 follows: |
| 280 |
| 281 ```bash |
| 282 pub global activate dart2js_info # only needed once |
| 283 dart2js_info_deferred_library_layout out.js.info.json |
| 284 ``` |
| 285 |
| 286 The tool will output a table listing all of the deferred output units or chunks, |
| 287 for each unit it will list the set of libraries that contribute code to this |
| 288 unit. If a library contributes to more than one output unit, the tool lists |
| 289 which elements are in one or another output unit. For example, the output might |
| 290 look like this: |
| 291 |
| 292 ``` |
| 293 Output unit main: |
| 294 loaded by default |
| 295 contains: |
| 296 - hello_world.dart |
| 297 - dart:core |
| 298 ... |
| 299 |
| 300 Output unit 2: |
| 301 loaded by importing: [b] |
| 302 contains: |
| 303 - c.dart: |
| 304 - function d |
| 305 - b.dart |
| 306 |
| 307 Output unit 1: |
| 308 loaded by importing: [a] |
| 309 contains: |
| 310 - c.dart: |
| 311 - function c |
| 312 - a.dart |
| 313 ``` |
| 314 |
| 315 In this example, all the code of `b.dart` after tree-shaking was included in the |
| 316 output unit 2, but `c.dart` was split between output unit 1 and output unit 2. |
| 317 |
273 ### Function size analysis tool | 318 ### Function size analysis tool |
274 | 319 |
275 This command-line tool presents how much each function contributes to the total | 320 This command-line tool presents how much each function contributes to the total |
276 code of your application. We use dependency information to compute dominance | 321 code of your application. We use dependency information to compute dominance |
277 and reachability data as well. | 322 and reachability data as well. |
278 | 323 |
279 When you run: | 324 When you run: |
280 ```bash | 325 ```bash |
281 pub global activate dart2js_info # only needed once | 326 pub global activate dart2js_info # only needed once |
282 dart2js_info_function_size_analysis out.js.info.json | 327 dart2js_info_function_size_analysis out.js.info.json |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 390 |
346 This package is developed in [github][repo]. Please file feature requests and | 391 This package is developed in [github][repo]. Please file feature requests and |
347 bugs at the [issue tracker][tracker]. | 392 bugs at the [issue tracker][tracker]. |
348 | 393 |
349 [repo]: https://github.com/dart-lang/dart2js_info/ | 394 [repo]: https://github.com/dart-lang/dart2js_info/ |
350 [tracker]: https://github.com/dart-lang/dart2js_info/issues | 395 [tracker]: https://github.com/dart-lang/dart2js_info/issues |
351 [code_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/code_deps
.dart | 396 [code_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/code_deps
.dart |
352 [lib_split]: https://github.com/dart-lang/dart2js_info/blob/master/bin/library_s
ize_split.dart | 397 [lib_split]: https://github.com/dart-lang/dart2js_info/blob/master/bin/library_s
ize_split.dart |
353 [deferred_lib]: https://github.com/dart-lang/dart2js_info/blob/master/bin/deferr
ed_library_check.dart | 398 [deferred_lib]: https://github.com/dart-lang/dart2js_info/blob/master/bin/deferr
ed_library_check.dart |
354 [deferred_size]: https://github.com/dart-lang/dart2js_info/blob/master/bin/defer
red_library_size.dart | 399 [deferred_size]: https://github.com/dart-lang/dart2js_info/blob/master/bin/defer
red_library_size.dart |
| 400 [deferred_layout]: https://github.com/dart-lang/dart2js_info/blob/master/bin/def
erred_library_layout.dart |
355 [coverage]: https://github.com/dart-lang/dart2js_info/blob/master/bin/coverage_l
og_server.dart | 401 [coverage]: https://github.com/dart-lang/dart2js_info/blob/master/bin/coverage_l
og_server.dart |
356 [live]: https://github.com/dart-lang/dart2js_info/blob/master/bin/live_code_size
_analysis.dart | 402 [live]: https://github.com/dart-lang/dart2js_info/blob/master/bin/live_code_size
_analysis.dart |
357 [function_analysis]: https://github.com/dart-lang/dart2js_info/blob/master/bin/f
unction_size_analysis.dart | 403 [function_analysis]: https://github.com/dart-lang/dart2js_info/blob/master/bin/f
unction_size_analysis.dart |
358 [AllInfo]: http://dart-lang.github.io/dart2js_info/doc/api/dart2js_info.info/All
Info-class.html | 404 [AllInfo]: http://dart-lang.github.io/dart2js_info/doc/api/dart2js_info.info/All
Info-class.html |
OLD | NEW |