@@ -63,6 +63,10 @@ The following tools are a available today:
63
63
dependency between functions and fields in your program. Currently it only
64
64
supports the ` some_path ` query, which shows a dependency path from one
65
65
function to another.
66
+
67
+ * [ ` diff ` ] [ diff ] : a tool that diffs two info files and reports which
68
+ program elements have been added, removed, or changed size. This also
69
+ tells which elements are no longer deferred or have become deferred.
66
70
67
71
* [ ` library_size_split ` ] [ lib_split ] : a tool that shows how much code was
68
72
attributed to each library. This tool is configurable so it can group data
@@ -102,10 +106,10 @@ this tool only supports the `some_path` query, which gives you the shortest path
102
106
for how one function depends on another.
103
107
104
108
Run this tool as follows:
105
- ``` bash
109
+ ``` console
106
110
# activate is only needed once to install the dart2js_info* executables
107
- pub global activate dart2js_info
108
- dart2js_info_code_deps out.js.info.json some_path main foo
111
+ $ pub global activate dart2js_info
112
+ $ dart2js_info_code_deps out.js.info.json some_path main foo
109
113
```
110
114
111
115
The arguments to the query are regular expressions that can be used to
@@ -120,22 +124,58 @@ a fully qualified element name, which includes the library and class name
120
124
If the name of a function your are looking for is unique enough, it might be
121
125
sufficient to just write that name as your regular expression.
122
126
127
+ ### Diff tool
128
+
129
+ This command-line tool shows a diff between two info files. It can be run
130
+ as follows:
131
+
132
+ ``` console
133
+ $ pub global activate dart2js_info # only needed once
134
+ $ dart2js_info_diff old.js.info.json new.js.info.json
135
+ ```
136
+
137
+ The tool gives a breakdown of the difference between the two info files.
138
+ Here's an example output:
139
+
140
+ ```
141
+ OVERALL SIZE DIFFERENCE
142
+ ========================================================================
143
+ 3 bytes
144
+
145
+ ADDED
146
+ ========================================================================
147
+
148
+ REMOVED
149
+ ========================================================================
150
+ file:///home/het/Code/foo/foo.dart::A.y: 0 bytes
151
+
152
+ CHANGED SIZE
153
+ ========================================================================
154
+
155
+ BECAME DEFERRED
156
+ ========================================================================
157
+
158
+ NO LONGER DEFERRED
159
+ ========================================================================
160
+
161
+ ```
162
+
123
163
### Library size split tool
124
164
125
165
This command-line tool shows the size distribution of generated code among
126
166
libraries. It can be run as follows:
127
167
128
- ``` bash
129
- pub global activate dart2js_info # only needed once
130
- dart2js_info_library_size_split out.js.info.json
168
+ ``` console
169
+ $ pub global activate dart2js_info # only needed once
170
+ $ dart2js_info_library_size_split out.js.info.json
131
171
```
132
172
133
173
134
174
Libraries can be grouped using regular expressions. You can
135
175
specify what regular expressions to use by providing a ` grouping.yaml ` file:
136
176
137
- ``` bash
138
- dart2js_info_library_size_split out.js.info.json grouping.yaml
177
+ ``` console
178
+ $ dart2js_info_library_size_split out.js.info.json grouping.yaml
139
179
```
140
180
141
181
The format of the ` grouping.yaml ` file is as follows:
@@ -205,9 +245,9 @@ bootstrapping code and lazy static initializers are missing.
205
245
This tool checks that the output from dart2js meets a given specification,
206
246
given in a YAML file. It can be run as follows :
207
247
208
- ` ` ` bash
209
- pub global activate dart2js_info # only needed once
210
- dart2js_info_deferred_library_check out.js.info.json manifest.yaml
248
+ ` ` ` console
249
+ $ pub global activate dart2js_info # only needed once
250
+ $ dart2js_info_deferred_library_check out.js.info.json manifest.yaml
211
251
` ` `
212
252
213
253
The format of the YAML file is :
@@ -253,7 +293,7 @@ This tool gives a breakdown of all of the deferred code in the program by size.
253
293
It can show how much of the total code size is deferred. It can be run as
254
294
follows :
255
295
256
- ` ` ` bash
296
+ ` ` ` console
257
297
pub global activate dart2js_info # only needed once
258
298
dart2js_info_deferred_library_size out.js.info.json
259
299
` ` `
@@ -278,9 +318,9 @@ Percent of code deferred 41.86%
278
318
This tool reports which code is included in each output unit. It can be run as
279
319
follows :
280
320
281
- ` ` ` bash
282
- pub global activate dart2js_info # only needed once
283
- dart2js_info_deferred_library_layout out.js.info.json
321
+ ` ` ` console
322
+ $ pub global activate dart2js_info # only needed once
323
+ $ dart2js_info_deferred_library_layout out.js.info.json
284
324
` ` `
285
325
286
326
The tool will output a table listing all of the deferred output units or chunks,
@@ -322,9 +362,9 @@ code of your application. We use dependency information to compute dominance
322
362
and reachability data as well.
323
363
324
364
When you run :
325
- ` ` ` bash
326
- pub global activate dart2js_info # only needed once
327
- dart2js_info_function_size_analysis out.js.info.json
365
+ ` ` ` console
366
+ $ pub global activate dart2js_info # only needed once
367
+ $ dart2js_info_function_size_analysis out.js.info.json
328
368
` ` `
329
369
330
370
the tool produces a table output with lots of entries. Here is an example entry
@@ -355,8 +395,8 @@ steps are as follows:
355
395
* Compile an app with dart2js using `--dump-info` and defining the
356
396
Dart environment `traceCalls=post` :
357
397
358
- ```
359
- DART_VM_OPTIONS="-DtraceCalls=post" dart2js --dump-info main.dart
398
+ ` ` ` console
399
+ $ DART_VM_OPTIONS="-DtraceCalls=post" dart2js --dump-info main.dart
360
400
` ` `
361
401
362
402
Because coverage/tracing data is currently experimental, the feature is
@@ -365,8 +405,8 @@ DART_VM_OPTIONS="-DtraceCalls=post" dart2js --dump-info main.dart
365
405
366
406
* Launch the coverage server tool to serve up the JS code of your app:
367
407
368
- ```bash
369
- dart2js_info_coverage_log_server main.dart.js
408
+ ` ` ` console
409
+ $ dart2js_info_coverage_log_server main.dart.js
370
410
` ` `
371
411
372
412
* (optional) If you have a complex application setup, you may need to serve an
@@ -382,8 +422,8 @@ dart2js_info_coverage_log_server main.dart.js
382
422
* Finally, run the live code analysis tool given it both the info and
383
423
coverage json files :
384
424
385
- ``` bash
386
- dart2js_info_live_code_size_analysis main.dart.info.json main.dart.coverage.json
425
+ ` ` ` console
426
+ $ dart2js_info_live_code_size_analysis main.dart.info.json main.dart.coverage.json
387
427
` ` `
388
428
389
429
# # Code location, features and bugs
@@ -394,6 +434,7 @@ bugs at the [issue tracker][tracker].
394
434
[repo] : https://github.com/dart-lang/dart2js_info/
395
435
[tracker] : https://github.com/dart-lang/dart2js_info/issues
396
436
[code_deps] : https://github.com/dart-lang/dart2js_info/blob/master/bin/code_deps.dart
437
+ [diff] : https://github.com/dart-lang/dart2js_info/blob/master/bin/diff.dart
397
438
[lib_split] : https://github.com/dart-lang/dart2js_info/blob/master/bin/library_size_split.dart
398
439
[deferred_lib] : https://github.com/dart-lang/dart2js_info/blob/master/bin/deferred_library_check.dart
399
440
[deferred_size] : https://github.com/dart-lang/dart2js_info/blob/master/bin/deferred_library_size.dart
0 commit comments