Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Cloning Array
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/132.0.0.0 Safari/537.36 Edg/132.0.0.0
Browser:
Chrome 132
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Spread
3857.7 Ops/sec
ForEach with push
414.4 Ops/sec
For with pre-allocated array
2115.7 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const userArray = new Array(100000).fill({firstName: 'lorenzo', lastName: 'gomez'});
Tests:
Spread
const spreadCopy = [...userArray]
ForEach with push
const forEachCopy = []; userArray.forEach(user => { forEachCopy.push(user); });
For with pre-allocated array
const preAllocatedArray = new Array(100000); for(let i= 0; i < 100000; i++){ preAllocatedArray[i] = userArray[i]; }