Script Preparation code:
x
 
var data = [...new Array(100)].map((_, i) => i);
var checkedPush = (array, item) => {
  for (let i = 0, len = array.length; i < len; ++i) {
    let isPresent = false;
    for (const oldItem of array) {
      if (oldItem === item) {
        isPresent = true;
        break;
      }
    }
    if (!isPresent) {
      array.push(item);
    }
  }
}
Tests:
  • Set

     
    var smallSet = new Set();
    for (const item of data) {
      smallSet.add(item);
    }
  • Checked array

     
    var smallArray = [];
    for (const item of data) {
      checkedPush(data, item);
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Set
    Checked array

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15
Safari 15 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Set 490191.9 Ops/sec
Checked array 944.6 Ops/sec