Get Private vs Public properties (v9)

Revision 9 of this benchmark created on


Setup

class C {
  #pri = 1;
  _pro = 1;
  pub = 1;
  get pri() {
    return this.#pri;
  }
  get pro() {
    return this._pro;
  }
  getPri() {
  	return this.#pri;
  }
  getPro() {
    return this._pro;
  }
}
const c = new C;
const o = {named:1};

Test runner

Ready to run.

Testing in
TestOps/sec
public field
c.pub;
ready
get "protected" field
c.pro;
ready
get private field
c.pri;
ready
getPro
c.getPro();
ready
getPri
c.getPri();
ready
named property
o.named;
ready

Revisions

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