Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Chrome 128
Mac OS X 10.15.7
Desktop
2 months ago
Test name Executions per second
Array includes 13741709.0 Ops/sec
Set has 14285850.0 Ops/sec
Map has 14781498.0 Ops/sec
Script Preparation code:
AخA
 
var a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var b = new Set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
var c = new Map([[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]);
Tests:
  • Array includes

     
    return a.includes(9);
  • Set has

     
    return b.has(9);
  • Map has

     
    return c.has(9);