Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
new Array from vs slice vs push vs index vs spread
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/137.0.0.0 Safari/537.36
Browser:
Chrome 137
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Array[index]
3.6M/s
Array.push
3.5M/s
Array.slice
946K/s
Array spread
844K/s
Array.from
755K/s
View exact numbers
Test name
Executions per second
✓
Array[index]
3,567,207 Ops/sec
Array.push
3,512,327 Ops/sec
Array.slice
946,316 Ops/sec
Array spread
844,243 Ops/sec
Array.from
755,273 Ops/sec
Tests:
Array.from
const elements = document.all; const arr = Array.from(elements);
Array.slice
const elements = document.all; const arr = Array.prototype.slice.call(elements, 0);
Array.push
const elements = document.all; const amount = elements.length; const arr = []; for (let i = 0; i < amount; i += 1) arr.push(elements[i]);
Array[index]
const elements = document.all; const amount = elements.length; const arr = Array(amount); for (let i = 0; i < amount; i += 1) arr[i] = elements[i];
Array spread
const elements = document.all; const arr = [...elements];