Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
Chrome 105
Windows
Desktop
2 years ago
Test name Executions per second
map 54517.7 Ops/sec
reflection 14826.8 Ops/sec
Script Preparation code:
AخA
 
var map = new Map();
var x = {};
for(let i = 0; i< 1000; i++){
    map.set(i.toString(), i);
    x[i.toString()] = i;
}
Tests:
  • map

     
    Array.from(map.entries()).filter(ent => ent[1]%2 == 0);
  • reflection

     
    const keys = Object.keys(x);
    keys.filter(key => x[key]%2==0);