HTML Preparation code:
AخA
 
1
<!--your preparation HTML code goes here-->
Script Preparation code:
x
 
const make = (length) => ({
  id: length,
  items: Array.from({ length }, () => make(length / 2))
})
const data = make(20)
Tests:
  • Map

     
    const ids = Array.from(new Set(
      data.items.map(
        i => i.items.map(
          ii => ii.items
        )
      ).flat(2)
      .filter(item => item.id % 2 === 0)
      .map(item => item.id.toString())
    ))
  • Loop

     
    const items = new Set()
    for (const i of data.items)
    for (const ii of i.items)
    for (const item of ii.items)
      if (item.id % 2 === 0) items.add(item.id.toString())
    const ids = Array.from(items)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Map
    Loop

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Map 55144.3 Ops/sec
Loop 143741.3 Ops/sec