Nested Named Functions compared to Module Pattern without last module pattern

JavaScript performance comparison

Revision 24 of this test case created by max jooher

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var Closure = (function() {
  
    var store;
  
    function inner(a) {
      store = a;
    };
  
    return {
  
      Nested: function(a) {
        function inner(a) {
          store = a;
        };
        inner(a);
      },
  
      Unnested: function(a) {
        inner(a)
      }
    }
  })();
  
  
  var flat;
  
  function Nested(a) {
    function inner(a) {
      flat = a;
    };
    inner(a);
  };
  
  function Unnested(a) {
    inner(a);
  }
  
  function inner(a) {
    flat = a;
  };

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Unnested
Unnested(1);
pending…
Nested
Nested(1);
pending…
Unnested inside Closure
Closure.Unnested(1);
pending…
Nested inside Closure
Closure.Nested(1);
pending…

Compare results of other browsers

Revisions

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

0 Comments