Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
desctructuring array keys vs access via index
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0
Browser:
Firefox 152
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one month ago
Index Access
229/s
Array Destructuring
140/s
View exact numbers
Test name
Executions per second
✓
Index Access
229 Ops/sec
Array Destructuring
140 Ops/sec
Script Preparation code:
const data = Array.from({length: 1_000_000}, () => [ Math.random(), Math.random(), Math.random(), ]);
Tests:
Array Destructuring
let sum1 = 0; for (let i = 0; i < data.length; i++) { const [a, b, c] = data[i]; sum1 += a + b + c; }
Index Access
let sum2 = 0; for (let i = 0; i < data.length; i++) { const arr = data[i]; sum2 += arr[0] + arr[1] + arr[2]; }