Script Preparation code:
Tests:
  • While Loop with cached parent_id

  • While Loop no caching parent_id

  • Using ForEach() instead of While Loop

  • While Loop without cache, using if/else instead of continue

  • While Loop without cache, using spread with assign

  • While Loop without cache, using spread only

  • For Loop version

  • Using ForEach() instead of While Loop, spread only

  • Using ForEach() instead of While Loop, spread only, no push()

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    While Loop with cached parent_id
    While Loop no caching parent_id
    Using ForEach() instead of While Loop
    While Loop without cache, using if/else instead of continue
    While Loop without cache, using spread with assign
    While Loop without cache, using spread only
    For Loop version
    Using ForEach() instead of While Loop, spread only
    Using ForEach() instead of While Loop, spread only, no push()

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0
Firefox 110 on Linux
View result in a separate tab
Test name Executions per second
While Loop with cached parent_id 49385.2 Ops/sec
While Loop no caching parent_id 40938.5 Ops/sec
Using ForEach() instead of While Loop 37674.7 Ops/sec
While Loop without cache, using if/else instead of continue 48730.6 Ops/sec
While Loop without cache, using spread with assign 28821.4 Ops/sec
While Loop without cache, using spread only 58936.9 Ops/sec
For Loop version 47289.8 Ops/sec
Using ForEach() instead of While Loop, spread only 53442.9 Ops/sec
Using ForEach() instead of While Loop, spread only, no push() 52848.4 Ops/sec


;