Test name | Executions per second |
---|---|
Read directly from prop | 18058308.0 Ops/sec |
Set directly to prop | 18058876.0 Ops/sec |
Read from getter | 18108138.0 Ops/sec |
Set to setter | 17917790.0 Ops/sec |
class MyObj {
prop = undefined
get propAccessor() {
return this.prop;
}
set propAccessor(val) {
this.prop = val;
}
}
var obj = new MyObj();
var value = obj.prop;
obj.prop = 123;
var value = obj.propAccessor;
obj.propAccessor = 123;