Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Property Get/Set vs Function vs Proxy
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/124.0.0.0 Safari/537.36
Browser:
Chrome 124
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Get/Set
13855.9 Ops/sec
Function
561245.4 Ops/sec
Proxy
4704.8 Ops/sec
Tests:
Get/Set
const obj = { __value: 0, get value() { return this.__value; }, set value(v) { this.__value = v; } }; function increase() { obj.value = obj.value + 1; } while (obj.value < 1000) { increase(); }
Function
const obj = { __value: 0, getValue() { return this.__value; }, setValue(v) { this.__value = v; } }; function increase() { obj.setValue(obj.getValue() + 1); } while (obj.getValue() < 1000) { increase(); }
Proxy
const obj = new Proxy( { value: 0 }, { get(obj, key) { return obj[key] }, set(obj, key, value) { obj[key] = value }, } ); function increase() { obj.value = obj.value + 1; } while (obj.value < 1000) { increase(); }