Test name | Executions per second |
---|---|
Object access | 6724176.0 Ops/sec |
Proxy access | 5248249.0 Ops/sec |
Proxy with get handler access | 2383119.0 Ops/sec |
Use of simple getter | 5467925.0 Ops/sec |
Use of defineProperty | 5107767.0 Ops/sec |
object = { value: 'data', getData() {return this.value;} };
Object.defineProperty(object, 'dataProperty', {
get() { return this.value; }
});
proxy = new Proxy(object, {})
proxyWithHandler = new Proxy(object, {
get(target, prop, receiver) {
return Reflect.get(target, prop, receiver)
}
})
object.value;
proxy.value
proxyWithHandler.value
object.getData();
object.dataProperty;