Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120
Linux
Desktop
one year ago
Test name Executions per second
Array.includes, 10 000 elements 40324.8 Ops/sec
Array.includes, 1 000 000 elements 349.9 Ops/sec
Set.has, 10 000 elements 1995100.0 Ops/sec
Set.has, 1 000 000 elements 1183228.8 Ops/sec
Array to Set + Set.has, 10 000 elements 1880.8 Ops/sec
Array to Set + Set.has x 100, 10 000 elements 1808.1 Ops/sec
Array.includes x 100, 10 000 elements 13524.3 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