test

Benchmark created on


Setup

function createHugeArray(arr) {
	for(let i = 0; i < 1e6; i++) {
		arr.push(i)
	}
}
const arr1 = createHugeArray([])
const arr2 = createHugeArray([])
arr2.push('a')
const set1 = new Set(arr1)
const set2 = new Set(arr2)

Test runner

Ready to run.

Testing in
TestOps/sec
array
return arr2.every(item => set1.has(item)); 
ready
set
return c.size > a.size ? c.difference(a).size : a.difference(c).size
ready

Revisions

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