Class constructor test

Test the performance of the Class constructor

by arctelix

HTML

<script src="https://rawgithub.com/arctelix/a24facdcf1d2804036b2/raw/0ba5b8c7bc83367d6505eb98ecc3f75e81bb8f77/class-constructor.js"></script>
<div id="output"></div>

CSS

.pass{
	color:green;
}
.fail{
	color:red;
}

JavaScript

//Class is obtained from : https://rawgithub.com/arctelix/a24facdcf1d2804036b2/raw/0ba5b8c7bc83367d6505eb98ecc3f75e81bb8f77/class-constructor.js

var options = {protoTest:0, debug:false, pInternal:true, debugSelf:false}

//regular revealing proto
var MyClass1 = Class({
    constructor: function MyClass1(name) {
        this.name = name;
        //internal
        //this.internal.internalVar = name+"'s internal value.";
    },
    // define prototype members
    prototype: function () {
        var static = 0;

        function getStatic() {
            return static;
        }
        
        function incStatic() {
            static++;
            return getStatic.call(this);
        }
        return {
            incStatic: incStatic,
        };
    },
    //or add public prototype methods directly
    toString: function () {
        return this.name;
    }
},options);
var c1 = new MyClass1('regular revealing proto mod')

//new revealing proto
var MyClass2 = Class({

    constructor: function MyClass2(name) {
        this.name = name;
        //internal
        //this.internal.internalVar = name+"'s internal value.";
    },
    // define prototype members
    prototype: function () {
        var static = 0;
        var getStatic = function() {
            return static;
        }
        this.incStatic = function() {
            static++;
            return getStatic.call(this);
        }
    },
    //or add public prototype methods directly
    toString: function () {
        return this.name;
    }
}, options)
var c2 = new MyClass2('new revealing proto')

//regular revealing proto with () only test 2
var MyClass3 = Class({
    constructor: function MyClass3(name) {
        this.name = name;
        //internal
        //this.internal.internalVar = name+"'s internal value.";
    },
    // define prototype members
    prototype: function () {
        var static = 0;

        function getStatic() {
            return static;
        }
        
        function...