spread vs from

Benchmark created on


Setup

const inArray = []
for (let i = 0; i < 300000; i++) {
	inArray.push(i)
}
const inSet = new Set(inArray)

Test runner

Ready to run.

Testing in
TestOps/sec
spread
const array = [...inSet]
ready
toArray
const array = Array.from(inSet)
ready

Revisions

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