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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0
Browser:
Chrome 133
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Get Function
234.4M/s
Get function wrapped in proxy
68.9M/s
Proxy access
44.1M/s
Proxy wrapped in proxy
30.1M/s
View exact numbers
Test name
Executions per second
✓
Get Function
234,383,712 Ops/sec
Get function wrapped in proxy
68,931,712 Ops/sec
Proxy access
44,140,048 Ops/sec
Proxy wrapped in proxy
30,115,650 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