Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
array spread vs concat vs from vs slice
Compare various ways of copying an array
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser:
Chrome 135
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Array.prototype.slice
103.8M/s
Array.prototype.concat
81.3M/s
spread operator
72.2M/s
Array.prototype.from
69.5M/s
View exact numbers
Test name
Executions per second
✓
Array.prototype.slice
103,844,488 Ops/sec
Array.prototype.concat
81,250,016 Ops/sec
spread operator
72,223,480 Ops/sec
Array.prototype.from
69,523,536 Ops/sec
Tests:
Array.prototype.concat
const array = [1, 2] const newArray = array.concat()
Array.prototype.from
const array = [1, 2] const newArray = Array.from(array)
Array.prototype.slice
const array = [1, 2] const newArray = array.slice(0)
spread operator
const array = [1, 2] const newArray = [...array]