This repository was archived by the owner on Feb 22, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +30
-14
lines changed Expand file tree Collapse file tree 1 file changed +30
-14
lines changed Original file line number Diff line number Diff line change @@ -7,26 +7,42 @@ main() {
7
7
var c = new Obj (1 );
8
8
InstanceMirror im = reflect (c);
9
9
Symbol symbol = new Symbol ('a' );
10
-
11
- var r = new Row ();
10
+ Watch head = new Watch ();
11
+ Watch current = head;
12
+ for (var i= 1 ; i < 10000 ; i++ ) {
13
+ Watch next = new Watch ();
14
+ current = (current.next = new Watch ());
15
+ }
16
+
17
+ var dirtyCheck = () {
18
+ Watch current = head;
19
+ while (current != null ) {
20
+ if (! identical (current.lastValue, current.im.getField (current.symbol).reflectee)) {
21
+ throw "We should not get here" ;
22
+ }
23
+ current = current.next;
24
+ }
25
+ };
12
26
13
27
time ('fieldRead' , () => im.getField (symbol).reflectee );
14
- time ('dirtyCheck' , () => ! identical (r.im.getField (r.symbol).reflectee, r.lastValue) );
15
- time ('dirtyCheck.gc' , () {
16
- new List (5 ).join ('' );
17
- return ! identical (r.im.getField (r.symbol).reflectee, r.lastValue);
18
- });
28
+ time ('Object.observe' , dirtyCheck);
29
+ }
30
+
31
+ class Watch {
32
+ dynamic lastValue = 1 ;
33
+ Watch next;
34
+ String location;
35
+ dynamic object = new Obj (1 );
36
+ InstanceMirror im;
37
+ Symbol symbol = new Symbol ('a' );
38
+
39
+ Watch () {
40
+ im = reflect (object);
41
+ }
19
42
}
20
43
21
44
class Obj {
22
45
var a;
23
46
24
47
Obj (this .a);
25
48
}
26
-
27
- class Row {
28
- var im = reflect (new Obj (1 ));
29
- var symbol = new Symbol ('a' );
30
- var lastValue;
31
- }
32
-
You can’t perform that action at this time.
0 commit comments