Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36
Chrome 118
Windows
Desktop
one year ago
Test name Executions per second
SET 10802026.0 Ops/sec
Obect 11886358.0 Ops/sec
Script Preparation code:
x
 
var a = [];
var b = {}
for (var i = 0; i < 1000000; i++) {
    a.push(i);
    b[i] = `${i}`;
}
var set = new Set([...a]);
Tests:
  • SET

     
    set.has(14500)
  • Obect

     
    b[14500]