Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.99 Safari/537.36
Chrome 88
Windows
Desktop
3 years ago
Test name Executions per second
vanilla 6137087.0 Ops/sec
proxy 4621869.0 Ops/sec
Script Preparation code:
AخA
 
object = {
    variant: data => ({
        variant: data
    })
};
proxy = new Proxy({}, {
    get(target, prop) {
        return data => ({
            [prop]: data
        })
    }
})
Tests:
  • vanilla

     
    object.variant("data")
  • proxy

     
    proxy.variant("data")