Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Proxy vs getter vs get function
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
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
Browser:
Chrome 129
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Get Function
6102582.5 Ops/sec
Proxy access
3322692.0 Ops/sec
Get function wrapped in proxy
3515740.5 Ops/sec
Proxy wrapped in proxy
2378614.0 Ops/sec
Script Preparation code:
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