Script Preparation code:
AخA
 
window.myObject = {};
window.mySet = new Set();
for (let i = 1; i < 1001; i++) {
  window.myObject[i] = null;
  window.mySet.add(i);
}
Tests:
  • Object.hasOwn

     
    for (let i = 1000; i > 0; i--) {
      Object.hasOwn(window.myObject, i);
    }
  • Set.prototype.has

     
    for (let i = 1000; i > 0; i--) {
      window.mySet.has(i);
    }
  • Object.prototype.hasOwnProperty

     
    for (let i = 1000; i > 0; i--) {
      window.myObject.hasOwnProperty(i);
    }
  • in

     
    for (let i = 1000; i > 0; i--) {
      i in window.myObject;
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Object.hasOwn
    Set.prototype.has
    Object.prototype.hasOwnProperty
    in

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0
Firefox 133 on Windows
View result in a separate tab
Test name Executions per second
Object.hasOwn 15110.4 Ops/sec
Set.prototype.has 15103.7 Ops/sec
Object.prototype.hasOwnProperty 15376.8 Ops/sec
in 15555.2 Ops/sec