Constructor Public Properties (v9)

Revision 9 of this benchmark created by Tri on


Description

Using prototype public properties vs. initialize public properties in a function constructor.

Test runner

Ready to run.

Testing in
TestOps/sec
instanciate constructor public properties
  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 = 10;
  }
  
 new ConstructorPublicProperties();
 
ready
instanciate prototype public properties
  function PrototypePublicProperties() {}
  PrototypePublicProperties.prototype = {
   publicProperty1: "1",
   publicProperty2: "2",
   publicProperty3: "3",
   publicProperty4: "4",
   publicProperty5: "5",
   publicProperty6: 6,
   publicProperty7: 7,
   publicProperty8: 8,
   publicProperty9: 9,
   publicProperty10: 10
  };
new PrototypePublicProperties()
ready
PrototypePublicProperties2
  function PrototypePublicProperties2() {}


  var p= PrototypePublicProperties2.prototype; 
   p.publicProperty1="1";
   p.publicProperty2= "2";
   p.publicProperty3="3";
   p.publicProperty4="4";
   p.publicProperty5= "5";
   p.publicProperty6= 6;
   p.publicProperty7= 7;
   p.publicProperty8=8;
   p.publicProperty9=9;
   p.publicProperty10=10;

new PrototypePublicProperties2()
ready

Revisions

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