Array.from vs Spread

Benchmark created on


Setup

window.mySet = new Set();
for (let i = 0; i < 1000000; i++) {
	window.mySet.add(i);
}

Test runner

Ready to run.

Testing in
TestOps/sec
Array.from
const newItem = Array.from(window.mySet);
ready
Spread
const mySet = [...window.mySet]
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.