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