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

Side by Side Diff: bin/deferred_library_size.dart

Issue 2380273003: Include more information when deserializing ProgramInfo (Closed)
Patch Set: Created 4 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/function_size_analysis.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /// This tool gives a breakdown of code size by deferred part in the program. 5 /// This tool gives a breakdown of code size by deferred part in the program.
6 library dart2js_info.bin.deferred_library_size; 6 library dart2js_info.bin.deferred_library_size;
7 7
8 import 'dart:math'; 8 import 'dart:math';
9 9
10 import 'package:dart2js_info/info.dart'; 10 import 'package:dart2js_info/info.dart';
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 } 29 }
30 30
31 void printSizes(Map<String, int> sizeByImport, int programSize) { 31 void printSizes(Map<String, int> sizeByImport, int programSize) {
32 var importSizes = <ImportSize>[]; 32 var importSizes = <ImportSize>[];
33 sizeByImport.forEach((import, size) { 33 sizeByImport.forEach((import, size) {
34 importSizes.add(new ImportSize(import, size)); 34 importSizes.add(new ImportSize(import, size));
35 }); 35 });
36 // Sort by size, largest first. 36 // Sort by size, largest first.
37 importSizes.sort((a, b) => b.size - a.size); 37 importSizes.sort((a, b) => b.size - a.size);
38 var longest = importSizes.fold('Percent of code deferred'.length, 38 int longest = importSizes.fold('Percent of code deferred'.length,
39 (longest, importSize) => max(longest, importSize.import.length)); 39 (longest, importSize) => max(longest, importSize.import.length));
40 40
41 _printRow(label, data, {int width: 15}) { 41 _printRow(label, data, {int width: 15}) {
42 print('${label.toString().padRight(longest + 1)}' 42 print('${label.toString().padRight(longest + 1)}'
43 '${data.toString().padLeft(width)}'); 43 '${data.toString().padLeft(width)}');
44 } 44 }
45 45
46 print(''); 46 print('');
47 print('Size by library'); 47 print('Size by library');
48 print('-' * (longest + 16)); 48 print('-' * (longest + 16));
(...skipping 18 matching lines...) Expand all
67 sizeByImport['main'] = outputUnit.size; 67 sizeByImport['main'] = outputUnit.size;
68 } else { 68 } else {
69 for (var import in outputUnit.imports) { 69 for (var import in outputUnit.imports) {
70 sizeByImport.putIfAbsent(import, () => 0); 70 sizeByImport.putIfAbsent(import, () => 0);
71 sizeByImport[import] += outputUnit.size; 71 sizeByImport[import] += outputUnit.size;
72 } 72 }
73 } 73 }
74 } 74 }
75 return sizeByImport; 75 return sizeByImport;
76 } 76 }
OLDNEW
« no previous file with comments | « no previous file | bin/function_size_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698