Performance Hands-On 16 - Tree

Performance Tool Hands-On

Instructions

  1. Open DevTools (F12 or Ctrl+Shift+I / Cmd+Option+I)
  2. Go to the Performance tab
  3. Click "Record" and then click "Run BFS" button
  4. Wait for the animation to complete, then stop recording
  5. Examine the flame chart to see the BFS call stack pattern
  6. Repeat the process with "Run DFS" button
  7. Compare the flame charts: notice how BFS processes nodes level by level, while DFS explores each branch fully before moving to siblings

Tips

  • Look for the yellow "processNode" blocks in the flame chart
  • Hover over function calls to see their duration
  • Use WASD keys to navigate the flame chart (zoom in/out, move left/right)
  • Try to identify which traversal method might be more efficient for different scenarios
  • Click on some of the functions, and see the next execution function connected with an arrow

Tree Traversal Demo