Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array.prototype.slice vs Array.from vs Spread with Node List
(version: 0)
Comparing performance of:
Array.prototype.slice on NodeList vs Array.prototype.concat on NodeList vs Array.from on NodeList vs Spread on NodeList
Created:
5 years ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<ul> </ul>
Script Preparation code:
var fooSet = new Set(); var ul = document.querySelector('ul'); for(var i=0;i<100;i++) { fooSet.add(i); ul.appendChild(document.createElement('li')); } var listItems = document.querySelectorAll('li');
Tests:
Array.prototype.slice on NodeList
var other = [].slice.call(fooSet);
Array.prototype.concat on NodeList
var other = [].concat.call([],fooSet);
Array.from on NodeList
var other = Array.from(listItems);
Spread on NodeList
var other = [...listItems];
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Array.prototype.slice on NodeList
Array.prototype.concat on NodeList
Array.from on NodeList
Spread on NodeList
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
spread vs slice vs splice
Array.prototype.slice Versus Spread Operator
Splice vs Spread to insert at beginning of array
Array.prototype.slice vs spread operator.
Array.prototype.slice vs spread op
Comments
Confirm delete:
Do you really want to delete benchmark?