Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Accessing Arrays vs Objects properties
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/141.0.0.0 Safari/537.36 Edg/141.0.0.0
Browser:
Chrome 141
Operating system:
Windows
Device Platform:
Desktop
Date tested:
6 months ago
Test name
Executions per second
Array access
12.0 Ops/sec
Object access
13.4 Ops/sec
Script Preparation code:
array = [32, 24, 2, 4]; object = { width: 32, height: 24, foo: 2, bar: 4 }; loops = 1000000; sum = 0;
Tests:
Array access
sum = 0; for(let i = 0; i < loops; i++) { sum += array[0] + array[1] + array[2] + array[3] + i; }
Object access
sum = 0; for(let i = 0; i < loops; i++) { sum += object.width + object.height + object.foo + object.bar + 1; }