Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Chrome 103
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
includes 2019.6 Ops/sec
lookup 22220590.0 Ops/sec
Script Preparation code:
AخA
 
var a = [];
for (var i = 0; i < 1E6; i++)
  a[i] = i;
var b = new Set(a)
Tests:
  • includes

     
    return a.includes(9E5)
  • lookup

     
    return b.has(9E5)