Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131
Linux
Desktop
one month ago
Test name Executions per second
Array.includes, 10 000 elements 126375.9 Ops/sec
Array.includes, 1 000 000 elements 1273.3 Ops/sec
Set.has, 10 000 elements 5323277.0 Ops/sec
Set.has, 1 000 000 elements 2981267.8 Ops/sec
Array to Set + Set.has, 10 000 elements 3578.8 Ops/sec
Array to Set + Set.has x 100, 10 000 elements 3422.7 Ops/sec
Array.includes x 100, 10 000 elements 1278.0 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