Set to Array

Benchmark created on


Setup

const s = new Set();
for (let i = 0; i < 1000; i++)
	s.add(i);

Teardown


Test runner

Ready to run.

Testing in
TestOps/sec
Array from
const a = Array.from(s);
ready
Spreading operator
const a = [...s];
ready
For loop
const a = [];
for (const v of s)
	a.push(v);
ready

Revisions

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