Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3 Mobile/15E148 Safari/604.1
Mobile Safari 17
iOS 17.3
Mobile
11 months ago
Test name Executions per second
Array.includes, 10 000 elements 49152.6 Ops/sec
Array.includes, 1 000 000 elements 458.0 Ops/sec
Set.has, 10 000 elements 3579381.5 Ops/sec
Set.has, 1 000 000 elements 3142014.5 Ops/sec
Array to Set + Set.has, 10 000 elements 1591.1 Ops/sec
Array to Set + Set.has x 100, 10 000 elements 1893.8 Ops/sec
Array.includes x 100, 10 000 elements 68.8 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