jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
Using prototype public properties vs. initialize public properties in a function constructor.
<script>
function ConstructorPublicProperties() {
this.publicProperty1 = 1;
this.publicProperty2 = 2;
this.publicProperty3 = 3;
this.publicProperty4 = 4;
this.publicProperty5 = 5;
this.publicProperty6 = 6;
this.publicProperty7 = 7;
this.publicProperty8 = 8;
this.publicProperty9 = 9;
this.publicProperty10 = (function() {
var i = 100;
while (i--);
return 10;
})();
}
function PrototypePublicProperties() {}
PrototypePublicProperties.prototype = {
publicProperty1: 1,
publicProperty2: 2,
publicProperty3: 3,
publicProperty4: 4,
publicProperty5: 5,
publicProperty6: 6,
publicProperty7: 7,
publicProperty8: 8,
publicProperty9: 9,
publicProperty10: (function() {
var i = 100;
while (i--);
return 10;
})()
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
instanciate constructor public properties |
| ready |
instanciate prototype public properties |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.