Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1
Mobile Safari 16
iOS 16.0
Mobile
one month ago
Test name Executions per second
Array.includes, 10 000 elements 51043.5 Ops/sec
Array.includes, 1 000 000 elements 485.8 Ops/sec
Set.has, 10 000 elements 4029816.5 Ops/sec
Set.has, 1 000 000 elements 1371416.4 Ops/sec
Array to Set + Set.has, 10 000 elements 2861.3 Ops/sec
Array to Set + Set.has x 100, 10 000 elements 2655.0 Ops/sec
Array.includes x 100, 10 000 elements 291.9 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