Set.has vs Array.include

Benchmark created on


Setup

const a = new Array()
const b = new Array()
for(i = 0; i < 100000; i++) {
	a.push(i);
	b.push(i * 2);
}

Test runner

Ready to run.

Testing in
TestOps/sec
Array.includes
a.map(n => b.includes(n))
ready
Set.has
const s = new Set(b)
a.map(n => s.has(n))
ready

Revisions

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