Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Access Object Property vs Global Let vs Private Let
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 18
Operating system:
iOS 18.2
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
Object
62787.1 Ops/sec
Global Let
60405.1 Ops/sec
Private Let
60598.3 Ops/sec
Script Preparation code:
const array = Array(1000); for (let arr of array) arr = Math.random(10); const obj = { a: 0, b: 0, } var ofunc = () => { for (let arr of array) { obj.a += arr; obj.b += obj.a + arr; } } let ga = 0; let gb = 0; var gfunc = () => { for (let arr of array) { ga += arr; gb += ga + arr; } } var pfunc = (() => { let a = 0; let b = 0; return () => { for (let arr of array) { a += arr; b += a + arr; } } })();
Tests:
Object
ofunc();
Global Let
gfunc();
Private Let
pfunc();