Array include vs Set has

Benchmark created on


Setup

const testArray = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
const testSet = new Set(testArray);
const testData = ['F','M','R','V','Y','Z',''];

Test runner

Ready to run.

Testing in
TestOps/sec
Array includes
testData.filter((val) => testArray.includes(val));
ready
Set has
testData.filter((val) => testSet.has(val));
ready

Revisions

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