Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array.from vs Spread vs Slice with Node List
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Browser:
Firefox 115
Operating system:
Windows 8.1
Device Platform:
Desktop
Date tested:
one year ago
Slice
482K/s
Spread
394K/s
Array.from
391K/s
Spread on NodeList
112K/s
Array.from on NodeList
112K/s
View exact numbers
Test name
Executions per second
✓
Slice
481,917 Ops/sec
Spread
394,334 Ops/sec
Array.from
390,618 Ops/sec
Spread on NodeList
111,740 Ops/sec
Array.from on NodeList
111,663 Ops/sec
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.from
var other = Array.from(fooSet);
Spread
var other = [...fooSet];
Array.from on NodeList
var other = Array.from(listItems);
Spread on NodeList
var other = [...listItems];
Slice
var other = [].slice.call(listItems);