Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(794)

Side by Side Diff: bin/function_size_analysis.dart

Issue 1412903002: include fields in verify_deps, refactor graph dfs (Closed) Base URL: git@github.com:dart-lang/dart2js_info.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | bin/verify_deps.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Command-line tool presenting how much each function contributes to the total 5 /// Command-line tool presenting how much each function contributes to the total
6 /// code. 6 /// code.
7 library compiler.tool.live_code_size_analysis; 7 library compiler.tool.live_code_size_analysis;
8 8
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 13 matching lines...) Expand all
24 {bool filter(Info info), bool showLibrarySizes: false}) { 24 {bool filter(Info info), bool showLibrarySizes: false}) {
25 var realTotal = info.program.size; 25 var realTotal = info.program.size;
26 if (filter == null) filter = (i) => true; 26 if (filter == null) filter = (i) => true;
27 var reported = [] 27 var reported = []
28 ..addAll(info.functions.where(filter)) 28 ..addAll(info.functions.where(filter))
29 ..addAll(info.fields.where(filter)); 29 ..addAll(info.fields.where(filter));
30 30
31 // Compute a graph from the dependencies in [info]. 31 // Compute a graph from the dependencies in [info].
32 Graph<Info> graph = graphFromInfo(info); 32 Graph<Info> graph = graphFromInfo(info);
33 33
34 // Compute the strongest connected components and calculate their size. 34 // Compute the strongly connected components and calculate their size.
35 var components = graph.computeTopologicalSort(); 35 var components = graph.computeTopologicalSort();
36 print('total elements: ${graph.nodes.length}'); 36 print('total elements: ${graph.nodes.length}');
37 print('total strongest connected components: ${components.length}'); 37 print('total strongly connected components: ${components.length}');
38 var maxS = 0; 38 var maxS = 0;
39 var totalCount = graph.nodeCount; 39 var totalCount = graph.nodeCount;
40 var minS = totalCount; 40 var minS = totalCount;
41 var nodeData = {}; 41 var nodeData = {};
42 for (var scc in components) { 42 for (var scc in components) {
43 var sccData = new _SccData(); 43 var sccData = new _SccData();
44 maxS = math.max(maxS, scc.length); 44 maxS = math.max(maxS, scc.length);
45 minS = math.min(minS, scc.length); 45 minS = math.min(minS, scc.length);
46 for (var f in scc) { 46 for (var f in scc) {
47 sccData.size += f.size; 47 sccData.size += f.size;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 _showElement(String name, int size, int dominatedSize, int maxSize, int total) { 158 _showElement(String name, int size, int dominatedSize, int maxSize, int total) {
159 var percent = (size * 100 / total).toStringAsFixed(2); 159 var percent = (size * 100 / total).toStringAsFixed(2);
160 var minPercent = (dominatedSize * 100 / total).toStringAsFixed(2); 160 var minPercent = (dominatedSize * 100 / total).toStringAsFixed(2);
161 var maxPercent = (maxSize * 100 / total).toStringAsFixed(2); 161 var maxPercent = (maxSize * 100 / total).toStringAsFixed(2);
162 print('${pad(size, 8)} ${pad(percent, 6)}% ' 162 print('${pad(size, 8)} ${pad(percent, 6)}% '
163 '${pad(dominatedSize, 10)} ${pad(minPercent, 6)}% ' 163 '${pad(dominatedSize, 10)} ${pad(minPercent, 6)}% '
164 '${pad(maxSize, 10)} ${pad(maxPercent, 6)}% ' 164 '${pad(maxSize, 10)} ${pad(maxPercent, 6)}% '
165 '$name'); 165 '$name');
166 } 166 }
OLDNEW
« no previous file with comments | « no previous file | bin/verify_deps.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698