HTML Preparation code:
AخA
 
1
<!--your preparation HTML code goes here-->
Script Preparation code:
x
 
const createTestData = (size) => {
    const arr = [];
    const obj = {};
    for (let i = 0; i < size; i++) {
        const id = `type:${i}`;
        const element = {
            id,
            value: Math.random()
        };
        arr.push(element);
        obj[id] = element;
    }
    return {
        arr,
        obj
    };
}
const data = createTestData(100000);
Tests:
  • 100 find

     
    const length = 100
    data.arr.slice(0, length).find(item => item.id === `type:${length}`);
  • 1000 find

     
    const length = 1000
    data.arr.slice(0, length).find(item => item.id === `type:${length}`);
  • 10000 find

     
    const length = 10000
    data.arr.slice(0, length).find(item => item.id === `type:${length}`);
  • 100000 find

     
    const length = 10000
    data.obj[`type:${length}`]
  • 10000 obj

     
    const length = 10000
    data.obj[`type:${length}`]
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    100 find
    1000 find
    10000 find
    100000 find
    10000 obj

    Fastest: N/A

    Slowest: N/A

Latest run results:

No previous run results

This benchmark does not have any results yet. Be the first one to run it!