HTML Preparation code:
AخA
 
1
<!--your preparation HTML code goes here-->
Script Preparation code:
 
/*your preparation JavaScript code goes here
To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/
async function globalMeasureThatScriptPrepareFunction() {}
Tests:
  • For-Each

    x
     
    const exampleObjects = Array.from(Array(1000)).map((_, i) => {
      const randomId = Math.round(Math.random() * 100);
      const otherRandomId = Math.round(Math.random() * 100);
      return {
        objectId: i % 3 === 0 ? undefined : randomId.toString(),
        clientObjectId: i % 4 === 0 ? undefined : otherRandomId.toString(),
      }
    });
    const objectIds = new Set(exampleObjects.map(i => i.objectId).filter(i => i !== undefined));
    const clientObjectIds = new Set(exampleObjects.map(i => i.clientObjectId).filter(i => i !== undefined));
  • map + filter twice

     
    const exampleObjects = Array.from(Array(1000)).map((_, i) => {
      const randomId = Math.round(Math.random() * 100);
      const otherRandomId = Math.round(Math.random() * 100);
      return {
        objectId: i % 3 === 0 ? undefined : randomId.toString(),
        clientObjectId: i % 4 === 0 ? undefined : otherRandomId.toString(),
      }
    });
    const objectIds = new Set();
    const clientObjectIds = new Set();
    for (const i of exampleObjects) {
      if (i.objectId) objectIds.add(i.objectId);
      if (i.clientObjectId) clientObjectIds.add(i.clientObjectId);
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    For-Each
    map + filter twice

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 7 days ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
For-Each 16738.5 Ops/sec
map + filter twice 20723.4 Ops/sec