`Array.includes` is ~28× slower than `Set.has`
If you test membership repeatedly, convert the array to a Set. Over 200,000 lookups the gap reaches 28×.
Result
| Run | `Array.includes` (100k array) | `Set.has` (same contents) | Ratio |
|---|---|---|---|
| Run 1 | 462.040 | 15.700 | 29.43× |
| Run 2 | 446.242 | 14.833 | 30.08× |
| Run 3 | 460.714 | 17.797 | 25.89× |
Conditions
200,000 membership tests against a 1,000-item set.
Where this number does not apply
For a few dozen lookups, building the Set costs more than it saves. Keep the array for one-off checks.
Reproduce
cd bench
node --expose-gc micro-fixed.mjs --out ../data/run.json --samples 21 Run it three times on the same machine; if the spread of median stays under 10%, you should land on the same conclusion. If your numbers disagree, tell us and we will retract.