Set.has() vs Array.includes() (v3)

Revision 3 of this benchmark created on


Description

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

Setup

const set = new Set([1,2,3,4,5]);
const arr = [1,2,3,4,5];

Test runner

Ready to run.

Testing in
TestOps/sec
Set.has()
const isIn = set.has(1) && set.has(2) && set.has(3) && set.has(4) && set.has(5);
ready
Array.includes()
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.