Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array.includes vs Set.has v3
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
Browser:
Chrome 144
Operating system:
Windows
Device Platform:
Desktop
Date tested:
4 months ago
Test name
Executions per second
Array.includes
73634.1 Ops/sec
Set.has
23266376.0 Ops/sec
Script Preparation code:
var testArr = []; for(let i = 0; i < 100000; i++) { testArr.push(i); } var testSet = new Set(testArr); var valuesToCheck = [0, 10, 200, 3000, 40000 ,500000];
Tests:
Array.includes
let summ = 0; valuesToCheck.forEach(v => { if (testArr.includes(v)) { summ += v; } }); return summ;
Set.has
let summ = 0; valuesToCheck.forEach(v => { if (testSet.has(v)) { summ += v; } }); return summ;