Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0
Firefox 110
Linux
Desktop
one year ago
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
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()


;