Reading Profiler Flamegraphs
What you'll learn: How to interpret the colorful bar charts in React DevTools Profiler to pinpoint which components are slowing down your app.
What is a Flamegraph?
A flamegraph is a visual representation of your React app's render performance. Think of it like a cross-section of a layered cake — each horizontal bar represents a component, stacked to show parent-child relationships. The width of each bar shows how long that component (and its children) took to render.
Reading the Visualization
When you record a profiling session (as you learned in the previous lesson), the flamegraph displays:
- Yellow/Orange bars: These components took longer to render
- Green/Blue bars: These rendered quickly
- Bar width: Represents render duration (wider = slower)
- Vertical stacking: Shows component hierarchy (children appear below parents)
What to Look For
Scan the flamegraph for:
- Wide yellow/orange bars — these are your slowest components
- Repeated patterns — components re-rendering unnecessarily multiple times
- Deep stacks — heavily nested components that might benefit from restructuring
Hover over any bar to see exact timing details and how many times that component rendered during the session.
The Analogy
Imagine filming a relay race from above. The flamegraph is like that bird's-eye view — you can instantly spot which runner (component) took the longest on their leg of the race, and whether any runner had to run multiple times when they should have run just once.
Key Takeaway: Flamegraphs reveal performance bottlenecks visually — look for wide, warm-colored bars to find slow components that need optimization.