Course contentsShow
← React
Lesson 2273 of 2,39650. Performance: Optimization TechniquesFree lesson

Profiling After Adding memo

Verify optimization worked by comparing before/after Profiler data.

Profiling After Adding memo

You'll learn: How to use the React DevTools Profiler to confirm that React.memo actually eliminated the unnecessary re-renders you targeted.

Why Profile Again?

Adding React.memo is only half the story. You need to verify it worked. Without re-profiling, you're flying blind—you might have introduced a custom comparison function with bugs, or the props might still be changing on every render due to reference inequality. The Profiler gives you proof.

The Before/After Comparison

Open the Profiler, record the same interaction you recorded before adding memo, and compare:

  1. Render count: Did the memoized component appear in fewer commits?
  2. Render time: Did the total time spent rendering that component drop?
  3. Flamegraph width: Is the memoized component missing from commits where its parent rendered but props didn't change?

Look at the "Why did this render?" panel. Before memo, you'd see "The parent component rendered." After memo, if it's working, you should see no entry for that component in commits where props stayed the same—or you'll see "Hook changed" only when props actually changed.

Reading Success

Success looks like:

  • Fewer commits containing your component
  • Shorter bars in the Ranked Chart
  • Gray "did not render" labels in the Flamegraph for commits where the parent re-rendered

If the component still appears in every commit, check for inline object/function props or review your custom comparison function.

Key Takeaway:
Always profile after adding memo to confirm it reduced re-renders; the Profiler's before/after data is your proof of optimization success.