Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array.prototype.slice vs spread operator vs Array.from benchmarch
(version: 1)
Compare the new ES6 spread operator with the traditional slice() method
Comparing performance of:
Array.prototype.slice vs spread operator vs Array.from
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var params = [ "hello", true, 7 ];
Tests:
Array.prototype.slice
var other = [ 1, 2 ].slice();
spread operator
var other = [ ...params ]
Array.from
var other = Array.from(params)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Array.prototype.slice
spread operator
Array.from
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser/OS:
Chrome 136 on Chrome OS 14541.0.0
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Array.prototype.slice
78616848.0 Ops/sec
spread operator
80140768.0 Ops/sec
Array.from
71654624.0 Ops/sec
Related benchmarks:
Array.prototype.slice vs spread operator 2
Array.prototype.slice vs spread operator (corrected!)
Array.prototype.slice(0) vs spread operator
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 by sean
Array.prototype.slice vs spread operator but corrent
Array.prototype.slice vs spread operator 73 3
Array.prototype.slice vs spread operator (better though)
Comments
Confirm delete:
Do you really want to delete benchmark?