dillon1000/react

Commit

[Fiber] Optimize enableProfilerCommitHooks by Collecting Elapsed Effect Duration in Module Scope (#30981)

Stacked on #30979.

The problem with the previous approach is that it recursively walked the
tree up to propagate the resulting time from recording a layout effect.

Instead, we keep a running count of the effect duration on the module
scope. Then we reset it when entering a nested Profiler and then we add
its elapsed count when we exit the Profiler.

This also fixes a bug where we weren't previously including unmount
times for some detached trees since they couldn't bubble up to find the
profiler.
Browse files
Changed paths7 files
First-parent comparison
M packages/react-reconciler/src/ReactFiberBeginWork.js ModifiedM packages/react-reconciler/src/ReactFiberCommitEffects.js ModifiedM packages/react-reconciler/src/ReactFiberCommitWork.js ModifiedM packages/react-reconciler/src/ReactFiberRoot.js ModifiedM packages/react-reconciler/src/ReactInternalTypes.js ModifiedM packages/react-reconciler/src/ReactProfilerTimer.js ModifiedM packages/react/src/__tests__/ReactProfiler-test.internal.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…