| Index: third_party/pkg/angular/perf/mirror_perf.dart
|
| ===================================================================
|
| --- third_party/pkg/angular/perf/mirror_perf.dart (revision 33054)
|
| +++ third_party/pkg/angular/perf/mirror_perf.dart (working copy)
|
| @@ -2,24 +2,20 @@
|
|
|
| import '_perf.dart';
|
| import 'dart:mirrors';
|
| -import 'package:angular/change_detection/dirty_checking_change_detector.dart';
|
|
|
| main() {
|
| - var c = new _Obj(1);
|
| + var c = new Obj(1);
|
| InstanceMirror im = reflect(c);
|
| - Symbol symbol = const Symbol('a');
|
| - _Watch head = new _Watch();
|
| - _Watch current = head;
|
| - GetterCache getterCache = new GetterCache({});
|
| - var detector = new DirtyCheckingChangeDetector<String>(getterCache);
|
| + Symbol symbol = new Symbol('a');
|
| + Watch head = new Watch();
|
| + Watch current = head;
|
| for(var i=1; i < 10000; i++) {
|
| - _Watch next = new _Watch();
|
| - current = (current.next = new _Watch());
|
| - detector.watch(c, 'a', '');
|
| + Watch next = new Watch();
|
| + current = (current.next = new Watch());
|
| }
|
|
|
| var dirtyCheck = () {
|
| - _Watch current = head;
|
| + Watch current = head;
|
| while(current != null) {
|
| if (!identical(current.lastValue, current.im.getField(current.symbol).reflectee)) {
|
| throw "We should not get here";
|
| @@ -29,7 +25,7 @@
|
| };
|
|
|
| var dirtyCheckFn = () {
|
| - _Watch current = head;
|
| + Watch current = head;
|
| while(current != null) {
|
| if (!identical(current.lastValue, current.getter(current.object))) {
|
| throw "We should not get here";
|
| @@ -38,28 +34,27 @@
|
| }
|
| };
|
|
|
| - xtime('fieldRead', () => im.getField(symbol).reflectee );
|
| - xtime('Object.observe', dirtyCheck);
|
| - xtime('Object.observe fn()', dirtyCheckFn);
|
| - time('ChangeDetection', detector.collectChanges);
|
| + time('fieldRead', () => im.getField(symbol).reflectee );
|
| + time('Object.observe', dirtyCheck);
|
| + time('Object.observe fn()', dirtyCheckFn);
|
| }
|
|
|
| -class _Watch {
|
| +class Watch {
|
| dynamic lastValue = 1;
|
| - _Watch next;
|
| + Watch next;
|
| String location;
|
| - dynamic object = new _Obj(1);
|
| + dynamic object = new Obj(1);
|
| InstanceMirror im;
|
| - Symbol symbol = const Symbol('a');
|
| + Symbol symbol = new Symbol('a');
|
| Function getter = (s) => s.a;
|
|
|
| - _Watch() {
|
| + Watch() {
|
| im = reflect(object);
|
| }
|
| }
|
|
|
| -class _Obj {
|
| +class Obj {
|
| var a;
|
|
|
| - _Obj(this.a);
|
| + Obj(this.a);
|
| }
|
|
|