Run details:
Mozilla/5.0 (Linux; arm_64; Android 11; Redmi Note 8T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.5.95.00 SA/3 Mobile Safari/537.36
Yandex Browser 23
Android
Mobile
one year ago
Test name Executions per second
Map 904082.1 Ops/sec
Array 651574.4 Ops/sec
Script Preparation code:
x
 
let map = new Map();
let arr = [];
let obj = {};
const randomU32 = function() {
    return Math.random() * (1 << 31) >>> 0;
}
Tests:
  • Map

     
    const randomU32 = function() {
        return Math.random() * (1 << 31) >>> 0;
    }
    const map = new Map();
    map.set(randomU32(), true);
  • Array

     
    const randomU32 = function() {
        return Math.random() * (1 << 31) >>> 0;
    }
    const arr = [];
    arr[randomU32()] = true;