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

Side by Side Diff: third_party/pkg/angular/perf/scope_perf.dart

Issue 1058283006: Update pubspecs and dependencies to get pkgbuild tests working. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
(Empty)
1 library scope_perf;
2
3 import '_perf.dart';
4 import 'package:angular/core/module.dart';
5 import 'package:angular/core/parser/parser.dart';
6 import 'package:di/di.dart';
7 import 'package:di/dynamic_injector.dart';
8
9 createInjector() {
10 return new DynamicInjector(
11 modules: [new Module()
12 ..type(Parser, implementedBy: DynamicParser)
13 ..type(ParserBackend, implementedBy: DynamicParserBackend)],
14 allowImplicitInjection:true);
15 }
16
17 var reactionFn = (_, __, ___) => null;
18 main() {
19 _fieldRead();
20 _mapRead();
21 _methodInvoke0();
22 _methodInvoke1();
23 _function2();
24 }
25
26 _fieldRead() {
27 var injector = createInjector();
28 var obj = new _Obj();
29 var scope = injector.get(Scope);
30 var parser = injector.get(Parser);
31 var parse = (exp) {
32 var fn = parser(exp).eval;
33 var o = obj;
34 return (s) => fn(o);
35 };
36 scope.watch(parse('a'), reactionFn);
37 scope.watch(parse('b'), reactionFn);
38 scope.watch(parse('c'), reactionFn);
39 scope.watch(parse('d'), reactionFn);
40 scope.watch(parse('e'), reactionFn);
41 scope.watch(parse('f'), reactionFn);
42 scope.watch(parse('g'), reactionFn);
43 scope.watch(parse('h'), reactionFn);
44 scope.watch(parse('i'), reactionFn);
45 scope.watch(parse('j'), reactionFn);
46 scope.watch(parse('k'), reactionFn);
47 scope.watch(parse('l'), reactionFn);
48 scope.watch(parse('m'), reactionFn);
49 scope.watch(parse('n'), reactionFn);
50 scope.watch(parse('o'), reactionFn);
51 scope.watch(parse('p'), reactionFn);
52 scope.watch(parse('q'), reactionFn);
53 scope.watch(parse('r'), reactionFn);
54 scope.watch(parse('s'), reactionFn);
55 scope.watch(parse('t'), reactionFn);
56 scope.apply();
57 time('fieldRead', () => scope.apply());
58 }
59
60 _mapRead() {
61 var map = {
62 'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4,
63 'f': 0, 'g': 1, 'h': 2, 'i': 3, 'j': 4,
64 'k': 0, 'l': 1, 'm': 2, 'n': 3, 'o': 4,
65 'p': 0, 'q': 1, 'r': 2, 's': 3, 't': 4};
66 var injector = createInjector();
67 var obj = new _Obj();
68 var scope = injector.get(Scope);
69 map.forEach((k, v) => scope[k] = v);
70
71 scope.watch('a', reactionFn);
72 scope.watch('b', reactionFn);
73 scope.watch('c', reactionFn);
74 scope.watch('d', reactionFn);
75 scope.watch('e', reactionFn);
76 scope.watch('f', reactionFn);
77 scope.watch('g', reactionFn);
78 scope.watch('h', reactionFn);
79 scope.watch('i', reactionFn);
80 scope.watch('j', reactionFn);
81 scope.watch('k', reactionFn);
82 scope.watch('l', reactionFn);
83 scope.watch('m', reactionFn);
84 scope.watch('n', reactionFn);
85 scope.watch('o', reactionFn);
86 scope.watch('p', reactionFn);
87 scope.watch('q', reactionFn);
88 scope.watch('r', reactionFn);
89 scope.watch('s', reactionFn);
90 scope.watch('t', reactionFn);
91 scope.apply();
92 time('mapRead', () => scope.apply());
93 }
94
95 _methodInvoke0() {
96 var context = new _Obj();
97 var injector = createInjector();
98 var obj = new _Obj();
99 var scope = injector.get(Scope);
100 scope.a = context;
101 scope.watch('a.methodA()', reactionFn);
102 scope.watch('a.methodB()', reactionFn);
103 scope.watch('a.methodC()', reactionFn);
104 scope.watch('a.methodD()', reactionFn);
105 scope.watch('a.methodE()', reactionFn);
106 scope.watch('a.methodF()', reactionFn);
107 scope.watch('a.methodG()', reactionFn);
108 scope.watch('a.methodH()', reactionFn);
109 scope.watch('a.methodI()', reactionFn);
110 scope.watch('a.methodJ()', reactionFn);
111 scope.watch('a.methodK()', reactionFn);
112 scope.watch('a.methodL()', reactionFn);
113 scope.watch('a.methodM()', reactionFn);
114 scope.watch('a.methodN()', reactionFn);
115 scope.watch('a.methodO()', reactionFn);
116 scope.watch('a.methodP()', reactionFn);
117 scope.watch('a.methodQ()', reactionFn);
118 scope.watch('a.methodR()', reactionFn);
119 scope.watch('a.methodS()', reactionFn);
120 scope.watch('a.methodT()', reactionFn);
121 scope.apply();
122 time('obj.method?()', () => scope.apply());
123 }
124
125 _methodInvoke1() {
126 var context = new _Obj();
127 var injector = createInjector();
128 var obj = new _Obj();
129 var scope = injector.get(Scope);
130 scope.a = context;
131 scope.watch('a.methodA(a)', reactionFn);
132 scope.watch('a.methodB(a)', reactionFn);
133 scope.watch('a.methodC(a)', reactionFn);
134 scope.watch('a.methodD(a)', reactionFn);
135 scope.watch('a.methodE(a)', reactionFn);
136 scope.watch('a.methodF(a)', reactionFn);
137 scope.watch('a.methodG(a)', reactionFn);
138 scope.watch('a.methodH(a)', reactionFn);
139 scope.watch('a.methodI(a)', reactionFn);
140 scope.watch('a.methodJ(a)', reactionFn);
141 scope.watch('a.methodK(a)', reactionFn);
142 scope.watch('a.methodL(a)', reactionFn);
143 scope.watch('a.methodM(a)', reactionFn);
144 scope.watch('a.methodN(a)', reactionFn);
145 scope.watch('a.methodO(a)', reactionFn);
146 scope.watch('a.methodP(a)', reactionFn);
147 scope.watch('a.methodQ(a)', reactionFn);
148 scope.watch('a.methodR(a)', reactionFn);
149 scope.watch('a.methodS(a)', reactionFn);
150 scope.watch('a.methodT(a)', reactionFn);
151 scope.apply();
152 time('obj.method?(obj)', () => scope.apply());
153 }
154
155 _function2() {
156 var injector = createInjector();
157 var obj = new _Obj();
158 obj.a = 1;
159 var scope = injector.get(Scope);
160 var parser = injector.get(Parser);
161 var aFn = parser('a').eval;
162 var add = () {
163 var fn = aFn;
164 var o = obj;
165 return (s) => fn(o) + fn(o);
166 };
167 scope.watch(add(), reactionFn);
168 scope.watch(add(), reactionFn);
169 scope.watch(add(), reactionFn);
170 scope.watch(add(), reactionFn);
171 scope.watch(add(), reactionFn);
172 scope.watch(add(), reactionFn);
173 scope.watch(add(), reactionFn);
174 scope.watch(add(), reactionFn);
175 scope.watch(add(), reactionFn);
176 scope.watch(add(), reactionFn);
177 scope.watch(add(), reactionFn);
178 scope.watch(add(), reactionFn);
179 scope.watch(add(), reactionFn);
180 scope.watch(add(), reactionFn);
181 scope.watch(add(), reactionFn);
182 scope.watch(add(), reactionFn);
183 scope.watch(add(), reactionFn);
184 scope.watch(add(), reactionFn);
185 scope.watch(add(), reactionFn);
186 scope.watch(add(), reactionFn);
187 scope.apply();
188 time('add?(a, a)', () => scope.apply());
189 }
190
191 class _Obj {
192 var a = 1;
193 var b = 2;
194 var c = 3;
195 var d = 4;
196 var e = 5;
197
198 var f = 6;
199 var g = 7;
200 var h = 8;
201 var i = 9;
202 var j = 10;
203
204 var k = 11;
205 var l = 12;
206 var m = 13;
207 var n = 14;
208 var o = 15;
209
210 var p = 16;
211 var q = 17;
212 var r = 18;
213 var s = 19;
214 var t = 20;
215
216 methodA([arg0]) => a;
217 methodB([arg0]) => b;
218 methodC([arg0]) => c;
219 methodD([arg0]) => d;
220 methodE([arg0]) => e;
221 methodF([arg0]) => f;
222 methodG([arg0]) => g;
223 methodH([arg0]) => h;
224 methodI([arg0]) => i;
225 methodJ([arg0]) => j;
226 methodK([arg0]) => k;
227 methodL([arg0]) => l;
228 methodM([arg0]) => m;
229 methodN([arg0]) => n;
230 methodO([arg0]) => o;
231 methodP([arg0]) => p;
232 methodQ([arg0]) => q;
233 methodR([arg0]) => r;
234 methodS([arg0]) => s;
235 methodT([arg0]) => t;
236 }
OLDNEW
« no previous file with comments | « third_party/pkg/angular/perf/pubspec.yaml ('k') | third_party/pkg/angular/perf/try_catch_perf.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698