Script Preparation code:
x
 
const obj = {
    a: 'a',
    b: 'b',
    c: 'c'
}
const proxyReflect = new Proxy(obj, {
    get(target, key, receiver) {
        return Reflect.get(target, key, receiver)
    }
})
const proxy = new Proxy(obj, {
    get(target, key, receiver) {
        return target[key]
    }
})
function getAFromProxy() {
    return proxy.a;
}
function getA() {
    return obj.a;
}
function getAFromFunction() {
    return getA()
}
function getAFromProxyReflect() {
    return proxyReflect.a;
}
const outerProxyGetFunction = new Proxy({}, {
    get(target, key, receiver) {
        return getAFromFunction()
    }
})
const outerProxyProxy = new Proxy({}, {
    get() {
        return getAFromProxy()
    }
})
const outerProxyProxyReflect = new Proxy({}, {
    get() {
        return getAFromProxyReflect()
    }
})
function getOuterProxyGetFunction(){
 return outerProxyGetFunction 
}
function getOuterProxyProxyAccess(){
 return outerProxyProxy 
}
function getOuterProxyReflectAccess(){
 return outerProxyProxyReflect 
}
Tests:
  • Get Function

     
    getAFromFunction()
  • proxy target[key]

     
    getAFromProxy()
  • proxy Reflect.get

     
    getAFromProxyReflect()
  • get function wrapped in proxy

     
    getOuterProxyGetFunction()
  • proxy wrapped in proxy

     
    getOuterProxyProxyAccess().a
  • proxy Reflect wrapped in proxy

     
    getOuterProxyReflectAccess()
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Get Function
    proxy target[key]
    proxy Reflect.get
    get function wrapped in proxy
    proxy wrapped in proxy
    proxy Reflect wrapped in proxy

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
Chrome 129 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Get Function 2827007.5 Ops/sec
proxy target[key] 8516738.0 Ops/sec
proxy Reflect.get 3260483.5 Ops/sec
get function wrapped in proxy 12656738.0 Ops/sec
proxy wrapped in proxy 4294401.5 Ops/sec
proxy Reflect wrapped in proxy 12784567.0 Ops/sec