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

     
    getAFromFunction()
  • Proxy access

     
    getAFromProxy()
  • Get function wrapped in proxy

     
    getOuterProxyGetFunction().a
  • Proxy wrapped in proxy

     
    getOuterProxyProxyAccess().a
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Get Function
    Proxy access
    Get function wrapped in proxy
    Proxy 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 3808593.5 Ops/sec
Proxy access 2245376.5 Ops/sec
Get function wrapped in proxy 3741139.5 Ops/sec
Proxy wrapped in proxy 2401995.0 Ops/sec