Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0
Firefox 118
Linux
Desktop
26 days ago
Test name Executions per second
Array.includes, 10 000 elements 21533.2 Ops/sec
Array.includes, 1 000 000 elements 200.5 Ops/sec
Set.has, 10 000 elements 6863807.0 Ops/sec
Set.has, 1 000 000 elements 6660393.5 Ops/sec
Array to Set + Set.has, 10 000 elements 527.2 Ops/sec
Array to Set + Set.has x 100, 10 000 elements 802.5 Ops/sec
Array.includes x 100, 10 000 elements 223.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