Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
chore(perf): getter function dirty comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed Dec 5, 2013
1 parent 5b3d5e2 commit 9735591
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions perf/mirror_perf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,19 @@ main() {
}
};

var dirtyCheckFn = () {
Watch current = head;
while(current != null) {
if (!identical(current.lastValue, current.getter(current.object))) {
throw "We should not get here";
}
current = current.next;
}
};

time('fieldRead', () => im.getField(symbol).reflectee );
time('Object.observe', dirtyCheck);
time('Object.observe fn()', dirtyCheckFn);
}

class Watch {
Expand All @@ -35,6 +46,7 @@ class Watch {
dynamic object = new Obj(1);
InstanceMirror im;
Symbol symbol = new Symbol('a');
Function getter = (s) => s.a;

Watch() {
im = reflect(object);
Expand Down

0 comments on commit 9735591

Please sign in to comment.