Set.has() vs Array.includes()

Benchmark created on


Description

Compare Set.has() vs Array.includes() performance

Test runner

Ready to run.

Testing in
TestOps/sec
Set.has()
const set = new Set([1,2,3,4,5]);
const isIn = set.has(1) && set.has(2) && set.has(3) && set.has(4) && set.has(5);
ready
Array.includes()
const arr = [1,2,3,4,5];
const isIn = arr.includes(1) && arr.includes(2) && arr.includes(3) && arr.includes(4) && arr.includes(5);
ready

Revisions

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