Run details:
Mozilla/5.0 (Android 14; Mobile; rv:130.0) Gecko/130.0 Firefox/130.0
Firefox Mobile 130
Android
Mobile
8 months ago
Test name Executions per second
Object 1166710016.0 Ops/sec
Set 1161168000.0 Ops/sec
Script Preparation code:
x
 
var set = new Set();
var object = {};
var array = new Array(5000).fill().map((_, i) => i);
for (let i = 0; i < array.length; i++) {
  object[i] = true;
}
for (let i = 0; i < array.length; i++) {
  set.add(i);
}
Tests:
  • Object

     
    object[40]
  • Set

     
    set.has(40)