@@ -63,6 +63,10 @@ The following tools are a available today:
6363 dependency between functions and fields in your program. Currently it only
6464 supports the ` some_path ` query, which shows a dependency path from one
6565 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.
6670
6771 * [ ` library_size_split ` ] [ lib_split ] : a tool that shows how much code was
6872 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
102106for how one function depends on another.
103107
104108Run this tool as follows:
105- ``` bash
109+ ``` console
106110# 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
109113```
110114
111115The 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
120124If the name of a function your are looking for is unique enough, it might be
121125sufficient to just write that name as your regular expression.
122126
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+
123163### Library size split tool
124164
125165This command-line tool shows the size distribution of generated code among
126166libraries. It can be run as follows:
127167
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
131171```
132172
133173
134174Libraries can be grouped using regular expressions. You can
135175specify what regular expressions to use by providing a ` grouping.yaml ` file:
136176
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
139179```
140180
141181The format of the ` grouping.yaml ` file is as follows:
@@ -205,9 +245,9 @@ bootstrapping code and lazy static initializers are missing.
205245This tool checks that the output from dart2js meets a given specification,
206246given in a YAML file. It can be run as follows :
207247
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
211251` ` `
212252
213253The 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.
253293It can show how much of the total code size is deferred. It can be run as
254294follows :
255295
256- ` ` ` bash
296+ ` ` ` console
257297pub global activate dart2js_info # only needed once
258298dart2js_info_deferred_library_size out.js.info.json
259299` ` `
@@ -278,9 +318,9 @@ Percent of code deferred 41.86%
278318This tool reports which code is included in each output unit. It can be run as
279319follows :
280320
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
284324` ` `
285325
286326The 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
322362and reachability data as well.
323363
324364When 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
328368` ` `
329369
330370the tool produces a table output with lots of entries. Here is an example entry
@@ -355,8 +395,8 @@ steps are as follows:
355395 * Compile an app with dart2js using `--dump-info` and defining the
356396 Dart environment `traceCalls=post` :
357397
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
360400` ` `
361401
362402 Because coverage/tracing data is currently experimental, the feature is
@@ -365,8 +405,8 @@ DART_VM_OPTIONS="-DtraceCalls=post" dart2js --dump-info main.dart
365405
366406 * Launch the coverage server tool to serve up the JS code of your app:
367407
368- ```bash
369- dart2js_info_coverage_log_server main.dart.js
408+ ` ` ` console
409+ $ dart2js_info_coverage_log_server main.dart.js
370410` ` `
371411
372412 * (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
382422 * Finally, run the live code analysis tool given it both the info and
383423 coverage json files :
384424
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
387427` ` `
388428
389429# # Code location, features and bugs
@@ -394,6 +434,7 @@ bugs at the [issue tracker][tracker].
394434[repo] : https://github.com/dart-lang/dart2js_info/
395435[tracker] : https://github.com/dart-lang/dart2js_info/issues
396436[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
397438[lib_split] : https://github.com/dart-lang/dart2js_info/blob/master/bin/library_size_split.dart
398439[deferred_lib] : https://github.com/dart-lang/dart2js_info/blob/master/bin/deferred_library_check.dart
399440[deferred_size] : https://github.com/dart-lang/dart2js_info/blob/master/bin/deferred_library_size.dart
0 commit comments