Set.has vs Array.include (v3)

Revision 3 of this 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 (loop)
a.map(n => b.includes(n))
ready
Set.has (loop)
const s = new Set(b)
a.map(n => s.has(n))
ready
Array.includes
b.includes(42)
ready
Set.has
const s = new Set(b)
s.has(42)
ready

Revisions

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