Test name | Executions per second |
---|---|
Read directly from prop | 14370123.0 Ops/sec |
Set directly to prop | 14438014.0 Ops/sec |
Read from getter | 14376883.0 Ops/sec |
Set to setter | 14431883.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;