for vs spread

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
for
const x = new Set();
const arr = new Array(1000).fill(0);
const l = arr.length;
for (var i = 0; i < l; i++) {
	x.add(arr);
}
ready
constructor
const arr = new Array(1000).fill(0);
const x = new Set(arr);
ready
spread
const arr = new Array(1000).fill(0);
const x = new Set([...arr]);
ready

Revisions

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