Test name | Executions per second |
---|---|
ES6 property (get) | 6782617.5 Ops/sec |
Getter function | 6795922.5 Ops/sec |
Directly get | 6767289.5 Ops/sec |
class Class {
constructor () {
this._val = 1
}
get value() { return this._val }
set value(x) { this._val = x }
getValue() { return this._val }
setValue(x) { this.val = x }
}
var cls = new Class()
var wtf
wtf = cls.value
wtf = cls.getValue()
wtf = cls._val