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 (Macintosh; Intel Mac OS X 10.15; rv:136.0) Gecko/20100101 Firefox/136.0
Browser:
Firefox 136
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
Array.slice
2.3M/s
Array[index]
2.2M/s
Array.push
2.1M/s
Array spread
1.4M/s
Array.from
1.4M/s
View exact numbers
Test name
Executions per second
✓
Array.slice
2,261,446 Ops/sec
Array[index]
2,221,134 Ops/sec
Array.push
2,131,856 Ops/sec
Array spread
1,418,666 Ops/sec
Array.from
1,380,026 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];