Early vs late object initialization

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
early
function a() {
  var a = {
    obj: null,
    init: function () {
      a.obj = 'foo';
    }
  };
  return a;
}

var aa = a();
aa.init();
ready
late
function b() {
  var b = {
    init: function () {
      b.obj = 'foo';
    }
  };
  return b;
}

var bb = b();
bb.init();
ready

Revisions

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