Init Private vs Public properties (v12)

Revision 12 of this benchmark created on


Setup

class CPrivate { #pri0; #pri1; #pri2; #pri3; #pri4; #pri5; #pri6; #pri7; #pri8; #pri9;

  bla() {
  	this.#pri0++
  	return this.#pri0
  }
}

class CPublic { pub0; pub1; pub2; pub3; pub4; pub5; pub6; pub7; pub8; pub9;

  bla() {
  	this.pub0++
  	return this.pub0
  }
}

class CConstructor { 
  constructor() { 
    this.pub0 = undefined;
    this.pub1 = undefined;
    this.pub2 = undefined;
    this.pub3 = undefined;
    this.pub4 = undefined;
    this.pub5 = undefined;
    this.pub6 = undefined;
    this.pub7 = undefined;
    this.pub8 = undefined;
    this.pub9 = undefined;
  }
  
  bla() {
  	this.pub0++
  	return this.pub0
  }
}

const output1 = new CPrivate();
const output2 = new CPublic();
const output3 = new CConstructor();

Test runner

Ready to run.

Testing in
TestOps/sec
private field
output1.bla();
ready
public field
output2.bla();
ready
pub in constructor
output3.bla();
ready

Revisions

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