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
Test name
Executions per second
Array.from
390618.0 Ops/sec
Spread
394333.6 Ops/sec
Array.from on NodeList
111663.5 Ops/sec
Spread on NodeList
111740.0 Ops/sec
Slice
481917.4 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);