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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 * [`code_deps.dart`][code_deps]: simple tool that can answer queries about the | 62 * [`code_deps.dart`][code_deps]: simple tool that can answer queries about the |
63 dependency between functions and fields in your program. Currently it only | 63 dependency between functions and fields in your program. Currently it only |
64 supports the `some_path` query, which shows a dependency path from one | 64 supports the `some_path` query, which shows a dependency path from one |
65 function to another. | 65 function to another. |
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 |
| 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 |
| 75 output from `dart2js` meets the specification. |
| 76 |
72 * [`function_size_analysis`][function_analysis]: a tool that shows how much | 77 * [`function_size_analysis`][function_analysis]: a tool that shows how much |
73 code was attributed to each function. This tool also uses dependency | 78 code was attributed to each function. This tool also uses dependency |
74 information to compute dominance and reachability data. This information can | 79 information to compute dominance and reachability data. This information can |
75 sometimes help determine how much savings could come if the function was not | 80 sometimes help determine how much savings could come if the function was not |
76 included in the program. | 81 included in the program. |
77 | 82 |
78 * [`coverage_log_server`][coverage] and [`live_code_size_analysis`][live]: | 83 * [`coverage_log_server`][coverage] and [`live_code_size_analysis`][live]: |
79 dart2js has an experimental feature to gather coverage data of your | 84 dart2js has an experimental feature to gather coverage data of your |
80 application. The `coverage_log_server` can record this data, and | 85 application. The `coverage_log_server` can record this data, and |
81 `live_code_size_analysis` can correlate that with the `.info.json`, so you | 86 `live_code_size_analysis` can correlate that with the `.info.json`, so you |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 - regexp: "file:///my/project/dir/(.*)" | 186 - regexp: "file:///my/project/dir/(.*)" |
182 ``` | 187 ``` |
183 | 188 |
184 Regardless of the grouping configuration, the tool will display the total code | 189 Regardless of the grouping configuration, the tool will display the total code |
185 size attributed of all libraries, constants, and the program size. | 190 size attributed of all libraries, constants, and the program size. |
186 | 191 |
187 **Note**: eventually you should expect all numbers to add up to the program | 192 **Note**: eventually you should expect all numbers to add up to the program |
188 size. Currently dart2js's `--dump-info` is not complete, so numbers for | 193 size. Currently dart2js's `--dump-info` is not complete, so numbers for |
189 bootstrapping code and lazy static initializers are missing. | 194 bootstrapping code and lazy static initializers are missing. |
190 | 195 |
| 196 ### Deferred library verification |
| 197 |
| 198 This tool checks that the output from dart2js meets a given specification, |
| 199 given in a YAML file. It can be run as follows: |
| 200 |
| 201 ```bash |
| 202 pub global activate dart2js_info # only needed once |
| 203 dart2js_info_deferred_library_check out.js.info.json manifest.yaml |
| 204 ``` |
| 205 |
| 206 The format of the YAML file is: |
| 207 |
| 208 ```yaml |
| 209 main: |
| 210 packages: |
| 211 - some_package |
| 212 - other_package |
| 213 |
| 214 foo: |
| 215 packages: |
| 216 - foo |
| 217 - bar |
| 218 |
| 219 baz: |
| 220 packages: |
| 221 - baz |
| 222 - quux |
| 223 ``` |
| 224 |
| 225 The YAML file consists of a list of declarations, one for each deferred |
| 226 part expected in the output. At least one of these parts must be named |
| 227 "main"; this is the main part that contains the program entrypoint. Each |
| 228 top-level part contains a list of package names that are expected to be |
| 229 contained in that part. Any package that is not explicitly listed is |
| 230 expected to be in the main part. For instance, in the example YAML above |
| 231 the part named "baz" is expected to contain the packages "baz" and "quux". |
| 232 |
| 233 The names for parts given in the specification YAML file (besides "main") |
| 234 are arbitrary and just used for reporting when the output does not meet the |
| 235 specification. |
| 236 |
191 ### Function size analysis tool | 237 ### Function size analysis tool |
192 | 238 |
193 This command-line tool presents how much each function contributes to the total | 239 This command-line tool presents how much each function contributes to the total |
194 code of your application. We use dependency information to compute dominance | 240 code of your application. We use dependency information to compute dominance |
195 and reachability data as well. | 241 and reachability data as well. |
196 | 242 |
197 When you run: | 243 When you run: |
198 ```bash | 244 ```bash |
199 pub global activate dart2js_info # only needed once | 245 pub global activate dart2js_info # only needed once |
200 dart2js_info_function_size_analysis out.js.info.json | 246 dart2js_info_function_size_analysis out.js.info.json |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 307 |
262 ## Code location, features and bugs | 308 ## Code location, features and bugs |
263 | 309 |
264 This package is developed in [github][repo]. Please file feature requests and | 310 This package is developed in [github][repo]. Please file feature requests and |
265 bugs at the [issue tracker][tracker]. | 311 bugs at the [issue tracker][tracker]. |
266 | 312 |
267 [repo]: https://github.com/dart-lang/dart2js_info/ | 313 [repo]: https://github.com/dart-lang/dart2js_info/ |
268 [tracker]: https://github.com/dart-lang/dart2js_info/issues | 314 [tracker]: https://github.com/dart-lang/dart2js_info/issues |
269 [code_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/code_deps
.dart | 315 [code_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/code_deps
.dart |
270 [lib_split]: https://github.com/dart-lang/dart2js_info/blob/master/bin/library_s
ize_split.dart | 316 [lib_split]: https://github.com/dart-lang/dart2js_info/blob/master/bin/library_s
ize_split.dart |
| 317 [lib_split]: https://github.com/dart-lang/dart2js_info/blob/master/bin/deferred_
library_check.dart |
271 [coverage]: https://github.com/dart-lang/dart2js_info/blob/master/bin/coverage_l
og_server.dart | 318 [coverage]: https://github.com/dart-lang/dart2js_info/blob/master/bin/coverage_l
og_server.dart |
272 [live]: https://github.com/dart-lang/dart2js_info/blob/master/bin/live_code_size
_analysis.dart | 319 [live]: https://github.com/dart-lang/dart2js_info/blob/master/bin/live_code_size
_analysis.dart |
273 [function_analysis]: https://github.com/dart-lang/dart2js_info/blob/master/bin/f
unction_size_analysis.dart | 320 [function_analysis]: https://github.com/dart-lang/dart2js_info/blob/master/bin/f
unction_size_analysis.dart |
274 [AllInfo]: http://dart-lang.github.io/dart2js_info/doc/api/dart2js_info.info/All
Info-class.html | 321 [AllInfo]: http://dart-lang.github.io/dart2js_info/doc/api/dart2js_info.info/All
Info-class.html |
OLD | NEW |