Test name | Executions per second |
---|---|
Object getter | 12778564.0 Ops/sec |
Proxy getter with Reflection | 4216735.5 Ops/sec |
Proxy getter without Reflection | 14883470.0 Ops/sec |
object = {
model: 'data',
get view() {
return this.model + ' by getter'
}
};
proxyWithReflection = new Proxy(object, {
get(target, prop, receiver) {
return Reflect.get(target, prop, receiver)
}
})
proxyWithoutReflection = new Proxy(object, {
get(target, prop, receiver) {
return target[prop]
}
})
object.view;
proxyWithReflection.view
proxyWithoutReflection