Set.has() vs Array.includes()

Benchmark created on


Setup

const array = [31, 107, 299];
const set = new Set(array);

Test runner

Ready to run.

Testing in
TestOps/sec
Set.has()
for (let i = 0; i < 10000; i++) {
	set.has(i);
}
ready
Array.includes()
for (let i = 0; i < 10000; i++) {
	array.includes(i);
}
ready

Revisions

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