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 |
| 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 |
| 79 your total code size can be loaded deferred. |
76 | 80 |
77 * [`function_size_analysis`][function_analysis]: a tool that shows how much | 81 * [`function_size_analysis`][function_analysis]: a tool that shows how much |
78 code was attributed to each function. This tool also uses dependency | 82 code was attributed to each function. This tool also uses dependency |
79 information to compute dominance and reachability data. This information can | 83 information to compute dominance and reachability data. This information can |
80 sometimes help determine how much savings could come if the function was not | 84 sometimes help determine how much savings could come if the function was not |
81 included in the program. | 85 included in the program. |
82 | 86 |
83 * [`coverage_log_server`][coverage] and [`live_code_size_analysis`][live]: | 87 * [`coverage_log_server`][coverage] and [`live_code_size_analysis`][live]: |
84 dart2js has an experimental feature to gather coverage data of your | 88 dart2js has an experimental feature to gather coverage data of your |
85 application. The `coverage_log_server` can record this data, and | 89 application. The `coverage_log_server` can record this data, and |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 contained in that part, a list of package names that are expected to be in | 237 contained in that part, a list of package names that are expected to be in |
234 another part, or both. For instance, in the example YAML above the part named | 238 another part, or both. For instance, in the example YAML above the part named |
235 "baz" is expected to contain the packages "baz" and "quux" and exclude the | 239 "baz" is expected to contain the packages "baz" and "quux" and exclude the |
236 package "zardoz". | 240 package "zardoz". |
237 | 241 |
238 The names for parts given in the specification YAML file (besides "main") | 242 The names for parts given in the specification YAML file (besides "main") |
239 are the same as the name given to the deferred import in the dart file. For | 243 are the same as the name given to the deferred import in the dart file. For |
240 instance, if you have `import 'package:foo/bar.dart' deferred as baz;` in your | 244 instance, if you have `import 'package:foo/bar.dart' deferred as baz;` in your |
241 dart file, then the corresponding name in the specification file is 'baz'. | 245 dart file, then the corresponding name in the specification file is 'baz'. |
242 | 246 |
| 247 ### Deferred library size tool |
| 248 |
| 249 This tool gives a breakdown of all of the deferred code in the program by size. |
| 250 It can show how much of the total code size is deferred. It can be run as |
| 251 follows: |
| 252 |
| 253 ```bash |
| 254 pub global activate dart2js_info # only needed once |
| 255 dart2js_info_deferred_library_size out.js.info.json |
| 256 ``` |
| 257 |
| 258 The tool will output a table listing all of the deferred imports in the program |
| 259 as well as the "main" chunk, which is not deferred. The output looks like: |
| 260 |
| 261 ``` |
| 262 Size by library |
| 263 ------------------------------------------------ |
| 264 main 12345678 |
| 265 foo 7654321 |
| 266 bar 1234567 |
| 267 ------------------------------------------------ |
| 268 Main chunk size 12345678 |
| 269 Deferred code size 8888888 |
| 270 Percent of code deferred 41.86% |
| 271 ``` |
| 272 |
243 ### Function size analysis tool | 273 ### Function size analysis tool |
244 | 274 |
245 This command-line tool presents how much each function contributes to the total | 275 This command-line tool presents how much each function contributes to the total |
246 code of your application. We use dependency information to compute dominance | 276 code of your application. We use dependency information to compute dominance |
247 and reachability data as well. | 277 and reachability data as well. |
248 | 278 |
249 When you run: | 279 When you run: |
250 ```bash | 280 ```bash |
251 pub global activate dart2js_info # only needed once | 281 pub global activate dart2js_info # only needed once |
252 dart2js_info_function_size_analysis out.js.info.json | 282 dart2js_info_function_size_analysis out.js.info.json |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 ## Code location, features and bugs | 344 ## Code location, features and bugs |
315 | 345 |
316 This package is developed in [github][repo]. Please file feature requests and | 346 This package is developed in [github][repo]. Please file feature requests and |
317 bugs at the [issue tracker][tracker]. | 347 bugs at the [issue tracker][tracker]. |
318 | 348 |
319 [repo]: https://github.com/dart-lang/dart2js_info/ | 349 [repo]: https://github.com/dart-lang/dart2js_info/ |
320 [tracker]: https://github.com/dart-lang/dart2js_info/issues | 350 [tracker]: https://github.com/dart-lang/dart2js_info/issues |
321 [code_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/code_deps
.dart | 351 [code_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/code_deps
.dart |
322 [lib_split]: https://github.com/dart-lang/dart2js_info/blob/master/bin/library_s
ize_split.dart | 352 [lib_split]: https://github.com/dart-lang/dart2js_info/blob/master/bin/library_s
ize_split.dart |
323 [deferred_lib]: https://github.com/dart-lang/dart2js_info/blob/master/bin/deferr
ed_library_check.dart | 353 [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 |
324 [coverage]: https://github.com/dart-lang/dart2js_info/blob/master/bin/coverage_l
og_server.dart | 355 [coverage]: https://github.com/dart-lang/dart2js_info/blob/master/bin/coverage_l
og_server.dart |
325 [live]: https://github.com/dart-lang/dart2js_info/blob/master/bin/live_code_size
_analysis.dart | 356 [live]: https://github.com/dart-lang/dart2js_info/blob/master/bin/live_code_size
_analysis.dart |
326 [function_analysis]: https://github.com/dart-lang/dart2js_info/blob/master/bin/f
unction_size_analysis.dart | 357 [function_analysis]: https://github.com/dart-lang/dart2js_info/blob/master/bin/f
unction_size_analysis.dart |
327 [AllInfo]: http://dart-lang.github.io/dart2js_info/doc/api/dart2js_info.info/All
Info-class.html | 358 [AllInfo]: http://dart-lang.github.io/dart2js_info/doc/api/dart2js_info.info/All
Info-class.html |
OLD | NEW |