prop-acces-v-prototype-chain (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script>
  P0 = function() {};
  P0.prototype.foo = 'bar';
  
  on = {};
  current = on;
  
  for (var i = 1, l = 10; i < l; i++) {
   this['P' + i] = function() {};
   this['P' + i].prototype = new this['P' + (i - 1)];
   current = current[String.fromCharCode(i + 96)] = {};
  }
  pn = new this['P' + (l - 1)];
  current.foo = 'bar';
  
  var p = new P4;
  var o = {
   a: {
    b: {
     c: {
      d: {
       foo: 'bar'
      }
     }
    }
   }
  }
  
  var p1 = new P1;
  var o1 = {
   foo: 'bar'
  };
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
access prototype chain
p.foo > Math.random()
ready
access property
o.a.b.c.d.foo > Math.random()
ready
1-lvl chain
p1.foo > Math.random()
ready
1-lvl access
o1.foo > Math.random()
ready
n-depth prototype chain
pn.foo > Math.random()
ready
n-depth object lookup
on.a.b.c.d.e.f.g.h.i.foo > Math.random()
ready

Revisions

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