Reading Profiler Flamegraphs
What you'll learn: How to interpret React's Profiler flamegraph to pinpoint exactly which components are slowing down your app and why.
Understanding the Flamegraph Layout
The flamegraph visualizes a single commit (render cycle) as a horizontal chart where:
- Width = how long that component took to render
- Color intensity = relative rendering cost (yellow/orange = expensive, gray = cheap)
- Vertical stacking = parent-child hierarchy (top = root, bottom = leaves)
Think of it like a performance "heat map" of your component tree. The wider and more colorful a bar, the more time React spent there.
What to Look For
1. Wide Bars = Render Duration Bottlenecks
A component that spans most of the horizontal space took significant time to render. This is your primary suspect for optimization.
2. Cascading Children
If a parent is wide and has many wide children stacked below, you're seeing a cascade: the parent re-rendered unnecessarily, forcing all children to re-render too. This is the classic memo opportunity.
3. Timing Numbers
Hover over any bar to see:
- Render duration for that component
- Total time including children
- Why it rendered (if you enabled that setting)
4. Commit Timing at Top
The commit bar shows total time for the entire render cycle. If it's over ~16ms, you risk dropping frames on 60fps devices.
Practical Workflow
Compare flamegraphs before/after an interaction. Did clicking a button cause 50 components to re-render? The flamegraph makes the waste visible instantly—no guessing required.
Key Takeaway: The flamegraph translates abstract "my app feels slow" into concrete data—which components rendered, for how long, and in what hierarchy—so you can optimize with surgical precision instead of guesswork.