Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JavaScript array copy methods for() vs spread operator
The idea is to test which array copy method performs better
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/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
for() method copy
44548492.0 Ops/sec
spread operator copy
92735944.0 Ops/sec
Tests:
for() method copy
let arr1 = [1,2,3,4,5,6,7,8,9,10]; let arr2 = []; for (let i=0; i<arr1.length; i+=1) {arr2.push(arr1[i]);}
spread operator copy
let arr1 = [1,2,3,4,5,6,7,8,9,10]; let arr2 = [...arr1];