Test name | Executions per second |
---|---|
Read directly from prop | 39015072.0 Ops/sec |
Set directly to prop | 37395028.0 Ops/sec |
Read from getter | 37401924.0 Ops/sec |
Set to setter | 37331644.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;