Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Chrome 121
Windows
Desktop
7 months ago
Test name Executions per second
Array.includes, 10 000 elements 102597.3 Ops/sec
Array.includes, 1 000 000 elements 1223.7 Ops/sec
Set.has, 10 000 elements 2671110.0 Ops/sec
Set.has, 1 000 000 elements 2163502.8 Ops/sec
Array to Set + Set.has, 10 000 elements 2651.8 Ops/sec
Array to Set + Set.has x 100, 10 000 elements 2474.1 Ops/sec
Array.includes x 100, 10 000 elements 32465.7 Ops/sec
Script Preparation code:
Tests:
  • Array.includes, 10 000 elements

  • Array.includes, 1 000 000 elements

  • Set.has, 10 000 elements

  • Set.has, 1 000 000 elements

  • Array to Set + Set.has, 10 000 elements

  • Array to Set + Set.has x 100, 10 000 elements

  • Array.includes x 100, 10 000 elements


;