Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.43
Chrome 117
Windows
Desktop
one year ago
Test name Executions per second
Array.find, 100 elementos 1874591.5 Ops/sec
Array.find, 10 000 elementos 112309.4 Ops/sec
Array.find, 1 000 000 elementos 207.1 Ops/sec
Array to Map + Map.get, 100 elementos 211992.2 Ops/sec
Array to Map + Map.get, 10 000 elementos 1384.1 Ops/sec
Array to Map + Map.get, 1 000 000 elementos 5.2 Ops/sec
Array.find, TINY, 10 buscas 188570.9 Ops/sec
Map.get, TINY, 10 buscas 111222.4 Ops/sec
Script Preparation code:
Tests:
  • Array.find, 100 elementos

  • Array.find, 10 000 elementos

  • Array.find, 1 000 000 elementos

  • Array to Map + Map.get, 100 elementos

  • Array to Map + Map.get, 10 000 elementos

  • Array to Map + Map.get, 1 000 000 elementos

  • Array.find, TINY, 10 buscas

  • Array to Map + Map.get, TINY, 10 buscas

  • Array.find, SMALL, 100 buscas

  • Array to Map + Map.get, SMALL, 100 buscas

  • Array.find, SMALL, 1000 buscas

  • Array to Map + Map.get, SMALL, 1000 buscas