Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array clone (spread vs slice vs array.from)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:153.0) Gecko/20100101 Firefox/153.0
Browser:
Firefox 153
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one month ago
Slice
9K/s
Spread
1K/s
Array.from
1K/s
View exact numbers
Test name
Executions per second
✓
Slice
9,076 Ops/sec
Spread
1,499 Ops/sec
Array.from
1,437 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const array = Array.from({ length: 128000 }, (_, i) => { return { i } })
Tests:
Spread
const copy = [...array];
Slice
const copy = array.slice();
Array.from
const copy = Array.from(array);