Get Private vs Public properties (v2)

Revision 2 of this benchmark created on


Setup

class C {
  #priv = 1;
  pub = 1;
  get priv() {
    return this.#priv;
  }
  get pub() {
    return this.pub;
  }
  getPriv() {
    return this.#priv;
  }
  getPub() {
    return this.pub;
  }
}
const c = new C;

Test runner

Ready to run.

Testing in
TestOps/sec
get private prop
c.getPriv();
ready
get public prop
c.getPub();
ready
getter private
c.priv;
ready
getter public
c.pub;
ready

Revisions

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