Module Pattern vs Anonymous Constructor (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script>
  function c() {
     var a = 1337;
     this.getA = function () {
        return a;
     };
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Module Pattern
var module = (function () {
   var a = 1337;
   return {
      getA: function () {
         return a;
      }
   }
})();
ready
Anonymous Constructor
var module = new c();
ready

Revisions

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