Test name | Executions per second |
---|---|
Return property class instance | 10780022.0 Ops/sec |
Return property of explicitly created object | 10652499.0 Ops/sec |
Return closure upvalue | 10628931.0 Ops/sec |
const O1 = class {
a = 1;
get() {
return this.a;
}
}
var o1 = new O1();
const O2 = function() {
return {
a: 1,
get: function() {
return this.a;
}
}
}
var o2 = new O2();
const O3 = function() {
let a = 1;
return {
get: function() {
return a;
}
}
}
var o3 = new O3();
o1.get()
o2.get()
o3.get()