Sibling functions vs nested functions (v2)

Revision 2 of this benchmark created by kostja on


Setup

var siblings = {
    foo: function() {},
    bar: function() { this.foo(); }
  };
  
  
  function foo1() {}
  var siblings1 = {
    bar: function() { foo1(); }
  };
  
  
  function bar1() {};
  var siblings1 = {
    bar: function () {
      bar1();
    }
  }
  
  var nested = {
    bar: function () {
      var foo = function() {};
      foo();
    }
  }
  
  var nested1 = {
    bar: function () {
      function foo() {};
      foo();
    }
  }
  
  
  var nestedClosed = {
    bar: function () {
      (function() {})();
    }
  }

Test runner

Ready to run.

Testing in
TestOps/sec
Siblings
siblings.bar();
ready
Nested
nested.bar();
ready
nested2
nested1.bar();
ready
Siblings1
siblings1.bar();
ready
Nested Closed
nestedClosed.bar();
ready

Revisions

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