Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array.prototype.slice vs spread operator on a bigger array with bigger elements
(version: 1)
Compare the new ES6 spread operator with the traditional slice() method on a bigger array.
Comparing performance of:
Array.prototype.slice vs spread operator
Created:
one year ago
by:
Guest
Go to the latest result
Script Preparation code:
var array = Array(10000).fill(Array(10000000).fill({ rand: Math.random(), randStr: 'str' + Math.random() }))
Tests:
Array.prototype.slice
var otherArray = array.slice();
spread operator
var otherArray = [...array];
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Array.prototype.slice
spread operator
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Browser/OS:
Chrome 130 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Array.prototype.slice
1.3M/s
spread operator
125K/s
View exact numbers
Test name
Executions per second
✓
Array.prototype.slice
1,315,582 Ops/sec
spread operator
124,964 Ops/sec
Related benchmarks
Array.prototype.slice vs spread operator.
Array.prototype.slice vs spread operator With slightly bigger array
Array.prototype.slice vs spread operator on a bigger array
Array.prototype.slice vs spread operator - large array 100000
Array.prototype.slice vs spread operator performance
Array.prototype.slice vs spread operator - large array 10000000
Comments
Confirm delete:
Do you really want to delete benchmark?