Script Preparation code:
Tests:
  • Array.find, 10 000 elements

  • Map.get, 10 000 elements

  • Array.find, 1 000 000 elements

  • Map.get, 1 000 000 elements

  • Array to Map + Map.get, 1 lookup

  • Array to Map + Map.get, 10 lookups

  • Array to Map + Map.get, 100 lookups

  • Array.find, 10 lookups

  • Array.find, 100 lookups

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Array.find, 10 000 elements
    Map.get, 10 000 elements
    Array.find, 1 000 000 elements
    Map.get, 1 000 000 elements
    Array to Map + Map.get, 1 lookup
    Array to Map + Map.get, 10 lookups
    Array to Map + Map.get, 100 lookups
    Array.find, 10 lookups
    Array.find, 100 lookups

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0
Firefox 117 on Ubuntu
View result in a separate tab
Test name Executions per second
Array.find, 10 000 elements 12469648.0 Ops/sec
Map.get, 10 000 elements 279199232.0 Ops/sec
Array.find, 1 000 000 elements 2394706.5 Ops/sec
Map.get, 1 000 000 elements 136371296.0 Ops/sec
Array to Map + Map.get, 1 lookup 481056.6 Ops/sec
Array to Map + Map.get, 10 lookups 476867.5 Ops/sec
Array to Map + Map.get, 100 lookups 451091.1 Ops/sec
Array.find, 10 lookups 1391412.5 Ops/sec
Array.find, 100 lookups 60305.1 Ops/sec


;