Object.observe polyfill

Benchmark created by Misko Hevery on


Setup

function createWatch(last) {
      return (last.next = {
        obj: {a:1, b:2, c:3},
        lastValue: 1,
        field: 'a',
        next: null
      });
    }
    var head = createWatch({});
    var current = head;
    for(var i = 1; i < 10000; i++) {
      current = createWatch(current);
    }
    
    dirtyCheck = function() {
      var current = head;
      while(current) {
        if (current.obj[current.field] !== current.lastValue) {
           throw "Should not get here";
        }
        current = current.next;
      }
    };

Test runner

Ready to run.

Testing in
TestOps/sec
dirtyCheck1
dirtyCheck()
ready
dirtyCheck2
dirtyCheck()
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Misko Hevery on
  • Revision 2: published by Misko Hevery on
  • Revision 3: published by Misko Hevery on
  • Revision 4: published by Misko Hevery on
  • Revision 5: published by Misko Hevery on
  • Revision 6: published by Misko Hevery on
  • Revision 7: published by Misko Hevery on
  • Revision 8: published by Misko Hevery on
  • Revision 9: published by Misko Hevery on
  • Revision 10: published by Misko Hevery on
  • Revision 11: published by Misko Hevery on
  • Revision 12: published by Misko Hevery on
  • Revision 13: published by Misko Hevery on
  • Revision 14: published by Misko Hevery on