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

Side by Side Diff: samples/third_party/dromaeo/Suites.dart

Issue 9732019: dart:html perf optimization based on runing Dromaeo benchmarks (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to code review comments Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
1 #library('Suites.dart'); 1 #library('Suites.dart');
2 2
3 class Origin { 3 class Origin {
4 final String author; 4 final String author;
5 final String url; 5 final String url;
6 6
7 const Origin(this.author, this.url); 7 const Origin(this.author, this.url);
8 } 8 }
9 9
10 class SuiteDescription { 10 class SuiteDescription {
11 final String file; 11 final String file;
12 final String name; 12 final String name;
13 final Origin origin; 13 final Origin origin;
14 final String description; 14 final String description;
15 final List<String> tags; 15 final List<String> tags;
16 16
17 const SuiteDescription(this.file, this.name, this.origin, 17 const SuiteDescription(this.file, this.name, this.origin,
18 this.description, this.tags); 18 this.description, this.tags);
19 } 19 }
20 20
21 class Suites { 21 class Suites {
22 static final JOHN_RESIG = const Origin('John Resig', 'http://ejohn.org/'); 22 static final JOHN_RESIG = const Origin('John Resig', 'http://ejohn.org/');
23 23
24 static final CATEGORIES = const { 24 static final CATEGORIES = const {
25 'dom': 'DOM Core Tests (dart:dom)', 25 'dom': 'DOM Core Tests (dart:dom)',
26 'html': 'DOM Core Tests (dart:html)', 26 'html': 'DOM Core Tests (dart:html)',
27 'htmlfast': 'DOM Core Tests (dart:html) Fast',
27 'js': 'DOM Core Tests (JavaScript)', 28 'js': 'DOM Core Tests (JavaScript)',
28 'dart': 'DOM Core Tests (dart)', 29 'dart': 'DOM Core Tests (dart)',
29 'frog': 'DOM Core Tests (frog)', 30 'frog': 'DOM Core Tests (frog)',
30 }; 31 };
31 32
32 static final _CORE_SUITE_DESCRIPTIONS = const [ 33 static final _CORE_SUITE_DESCRIPTIONS = const [
33 const SuiteDescription( 34 const SuiteDescription(
34 'dom-attr.html', 35 'dom-attr.html',
35 'DOM Attributes', 36 'DOM Attributes',
36 JOHN_RESIG, 37 JOHN_RESIG,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 suite.description, 69 suite.description,
69 combined); 70 combined);
70 } 71 }
71 return suites.map(getVariant); 72 return suites.map(getVariant);
72 } 73 }
73 74
74 // Mappings from original path to Dart-specific variants. 75 // Mappings from original path to Dart-specific variants.
75 static _jsPath(path) => path; 76 static _jsPath(path) => path;
76 static _domPath(path) => path.replaceFirst('.html', '-dom.html'); 77 static _domPath(path) => path.replaceFirst('.html', '-dom.html');
77 static _htmlPath(path) => path.replaceFirst('.html', '-html.html'); 78 static _htmlPath(path) => path.replaceFirst('.html', '-html.html');
79 static _htmlFastPath(path) => path.replaceFirst('.html', '-htmlfast.html');
78 static _frogDomPath(path) => 80 static _frogDomPath(path) =>
79 'frog/${path.replaceFirst(".html", "-dom-js.html")}'; 81 'frog/${path.replaceFirst(".html", "-dom-js.html")}';
80 static _frogHtmlPath(path) => 82 static _frogHtmlPath(path) =>
81 'frog/${path.replaceFirst(".html", "-html-js.html")}'; 83 'frog/${path.replaceFirst(".html", "-html-js.html")}';
84 static _frogHtmlFastPath(path) =>
85 'frog/${path.replaceFirst(".html", "-htmlfast-js.html")}';
82 86
83 static var _SUITE_DESCRIPTIONS; 87 static var _SUITE_DESCRIPTIONS;
84 88
85 static List<SuiteDescription> get SUITE_DESCRIPTIONS() { 89 static List<SuiteDescription> get SUITE_DESCRIPTIONS() {
86 if (null !== _SUITE_DESCRIPTIONS) { 90 if (null !== _SUITE_DESCRIPTIONS) {
87 return _SUITE_DESCRIPTIONS; 91 return _SUITE_DESCRIPTIONS;
88 } 92 }
89 _SUITE_DESCRIPTIONS = <SuiteDescription>[]; 93 _SUITE_DESCRIPTIONS = <SuiteDescription>[];
90 add(variant, mapper, tags) { 94 add(variant, mapper, tags) {
91 _SUITE_DESCRIPTIONS.addAll( 95 _SUITE_DESCRIPTIONS.addAll(
92 getVariants(_CORE_SUITE_DESCRIPTIONS, variant, mapper, tags)); 96 getVariants(_CORE_SUITE_DESCRIPTIONS, variant, mapper, tags));
93 } 97 }
94 add('js', _jsPath, ['js']); 98 add('js', _jsPath, ['js']);
95 add('dart:dom', _domPath, ['dart', 'dom']); 99 add('dart:dom', _domPath, ['dart', 'dom']);
96 add('dart:html', _htmlPath, ['dart', 'html']); 100 add('dart:html', _htmlPath, ['dart', 'html']);
101 add('dart:html fast', _htmlPath, ['dart', 'htmlfast']);
97 add('frog dart:dom', _frogDomPath, ['frog', 'dom']); 102 add('frog dart:dom', _frogDomPath, ['frog', 'dom']);
98 add('frog dart:html', _frogHtmlPath, ['frog', 'html']); 103 add('frog dart:html', _frogHtmlPath, ['frog', 'html']);
104 add('frog dart:html fast', _frogHtmlFastPath, ['frog', 'htmlfast']);
99 return _SUITE_DESCRIPTIONS; 105 return _SUITE_DESCRIPTIONS;
100 } 106 }
101 107
102 static List<SuiteDescription> getSuites(String tags) { 108 static List<SuiteDescription> getSuites(String tags) {
103 // A disjunction of conjunctions (e.g., 109 // A disjunction of conjunctions (e.g.,
104 // 'js&modify|dart&dom&modify'). 110 // 'js&modify|dart&dom&modify').
105 final taglist = tags.split('|').map((tag) => tag.split('&')); 111 final taglist = tags.split('|').map((tag) => tag.split('&'));
106 112
107 bool match(suite) { 113 bool match(suite) {
108 // If any conjunction matches, return true. 114 // If any conjunction matches, return true.
(...skipping 15 matching lines...) Expand all
124 return CATEGORIES[tags]; 130 return CATEGORIES[tags];
125 } 131 }
126 for (final suite in _CORE_SUITE_DESCRIPTIONS) { 132 for (final suite in _CORE_SUITE_DESCRIPTIONS) {
127 if (suite.tags[0] == tags) { 133 if (suite.tags[0] == tags) {
128 return suite.name; 134 return suite.name;
129 } 135 }
130 } 136 }
131 return null; 137 return null;
132 } 138 }
133 } 139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698