| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 specification implicitly defines several groups, one per observed name. | 143 specification implicitly defines several groups, one per observed name. |
| 144 | 144 |
| 145 * `cluster` (optional): a clustering index for how data is shown in a table. | 145 * `cluster` (optional): a clustering index for how data is shown in a table. |
| 146 Groups with higher cluster indices are shown later in the table after a | 146 Groups with higher cluster indices are shown later in the table after a |
| 147 dividing line. If missing, the cluster index defaults to 0. | 147 dividing line. If missing, the cluster index defaults to 0. |
| 148 | 148 |
| 149 Here is an example configuration, with comments about what each entry does: | 149 Here is an example configuration, with comments about what each entry does: |
| 150 | 150 |
| 151 ```yaml | 151 ```yaml |
| 152 groups: | 152 groups: |
| 153 # This group shows the total size of all libraries together, it is shown in | |
| 154 # cluster #3, which happens to be the last cluster in this example: | |
| 155 - name: "Total (excludes preambles, statics & consts)" | |
| 156 regexp: ".*" | |
| 157 cluster: 3 | |
| 158 | |
| 159 # This group shows the total size for all libraries that were loaded from | 153 # This group shows the total size for all libraries that were loaded from |
| 160 # file:// urls: | 154 # file:// urls, it is shown in cluster #2, which happens to be the last |
| 161 - { name: "Loose files", regexp: "file://.*", cluster: 2} | 155 # cluster in this example before the totals are shown: |
| 156 - name: "Loose files" |
| 157 regexp: "file://.*" |
| 158 cluster: 2 |
| 162 | 159 |
| 163 # This group shows the total size of all code loaded from packages: | 160 # This group shows the total size of all code loaded from packages: |
| 164 - { name: "All packages", regexp: "package:.*", cluster: 2} | 161 - { name: "All packages", regexp: "package:.*", cluster: 2} |
| 165 | 162 |
| 166 # This group shows the total size of all code loaded from core libraries: | 163 # This group shows the total size of all code loaded from core libraries: |
| 167 - { name: "Core libs", regexp: "dart:.*", cluster: 2} | 164 - { name: "Core libs", regexp: "dart:.*", cluster: 2} |
| 168 | 165 |
| 169 # This group shows the total size of all libraries in a single package. Here | 166 # This group shows the total size of all libraries in a single package. Here |
| 170 # we omitted the `name` entry, instead we extract it from the regexp | 167 # we omitted the `name` entry, instead we extract it from the regexp |
| 171 # directly. In this case, the name will be the package-name portion of the | 168 # directly. In this case, the name will be the package-name portion of the |
| 172 # package-url (determined by group(1) of the regexp). | 169 # package-url (determined by group(1) of the regexp). |
| 173 - { regexp: "package:([^/]*)", cluster: 1} | 170 - { regexp: "package:([^/]*)", cluster: 1} |
| 174 | 171 |
| 175 # The next two groups match the entire library url as the name of the group. | 172 # The next two groups match the entire library url as the name of the group. |
| 176 - regexp: "package:.*" | 173 - regexp: "package:.*" |
| 177 - regexp: "dart:.*" | 174 - regexp: "dart:.*" |
| 178 | 175 |
| 179 # If your code lives under /my/project/dir, this will match any file loaded | 176 # If your code lives under /my/project/dir, this will match any file loaded |
| 180 from a file:// url, and we use as a name the relative path to it. | 177 from a file:// url, and we use as a name the relative path to it. |
| 181 - regexp: "file:///my/project/dir/(.*)" | 178 - regexp: "file:///my/project/dir/(.*)" |
| 182 ``` | 179 ``` |
| 183 | 180 |
| 181 Regardless of the grouping configuration, the tool will display the total code |
| 182 size attributed of all libraries, constants, and the program size. |
| 183 |
| 184 **Note**: eventually you should expect all numbers to add up to the program |
| 185 size. Currently dart2js's `--dump-info` is not complete, so numbers for |
| 186 bootstraping code and lazy static initializers are missing. |
| 187 |
| 184 ### Function size analysis tool | 188 ### Function size analysis tool |
| 185 | 189 |
| 186 This command-line tool presents how much each function contributes to the total | 190 This command-line tool presents how much each function contributes to the total |
| 187 code of your application. We use dependency information to compute dominance | 191 code of your application. We use dependency information to compute dominance |
| 188 and reachability data as well. | 192 and reachability data as well. |
| 189 | 193 |
| 190 When you run: | 194 When you run: |
| 191 ```bash | 195 ```bash |
| 192 pub global activate dart2js_info # only needed once | 196 pub global activate dart2js_info # only needed once |
| 193 pub global run dart2js_info:function_size_analysis out.js.info.json | 197 pub global run dart2js_info:function_size_analysis out.js.info.json |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 bugs at the [issue tracker][tracker]. | 262 bugs at the [issue tracker][tracker]. |
| 259 | 263 |
| 260 [repo]: https://github.com/dart-lang/dart2js_info/ | 264 [repo]: https://github.com/dart-lang/dart2js_info/ |
| 261 [tracker]: https://github.com/dart-lang/dart2js_info/issues | 265 [tracker]: https://github.com/dart-lang/dart2js_info/issues |
| 262 [code_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/code_deps
.dart | 266 [code_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/code_deps
.dart |
| 263 [lib_split]: https://github.com/dart-lang/dart2js_info/blob/master/bin/library_s
ize_split.dart | 267 [lib_split]: https://github.com/dart-lang/dart2js_info/blob/master/bin/library_s
ize_split.dart |
| 264 [coverage]: https://github.com/dart-lang/dart2js_info/blob/master/bin/coverage_l
og_server.dart | 268 [coverage]: https://github.com/dart-lang/dart2js_info/blob/master/bin/coverage_l
og_server.dart |
| 265 [live]: https://github.com/dart-lang/dart2js_info/blob/master/bin/live_code_size
_analysis.dart | 269 [live]: https://github.com/dart-lang/dart2js_info/blob/master/bin/live_code_size
_analysis.dart |
| 266 [function_analysis]: https://github.com/dart-lang/dart2js_info/blob/master/bin/f
unction_size_analysis.dart | 270 [function_analysis]: https://github.com/dart-lang/dart2js_info/blob/master/bin/f
unction_size_analysis.dart |
| 267 [AllInfo]: http://dart-lang.github.io/dart2js_info/doc/api/dart2js_info.info/All
Info-class.html | 271 [AllInfo]: http://dart-lang.github.io/dart2js_info/doc/api/dart2js_info.info/All
Info-class.html |
| OLD | NEW |