Namespaced anonymous wrapped prototype functions (v34)

Revision 34 of this benchmark created on


Description

Compare namespaced functions, wrapped inside anonymous scope vs default functions.

Setup

function Core() {};
    Core.prototype = Core;
    
    (function() {
    
      var ii = 0;
      var result = 0;
    
      Core.test1 = function(length) {
        result = 0;
        ii = 0;
        for (; ii < length; ++ii) {
          ++result;
        };
      };
    
    })();
    
    var kk = 0;
    var res = 0;
    
    Core.test2 = function(length) {
      res = 0;
      kk = 0;
      for (; kk < length; ++kk) {
        ++res;
      };
    };

Test runner

Ready to run.

Testing in
TestOps/sec
Anonymous namespace wrapped
Core.test1(1E2);
ready
Global scoped function
Core.test2(1E2);
ready
infinity
true
ready

Revisions

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