React Performance tracks

React Performance tracks are specialized custom entries that appear on the Performance panel’s timeline in your browser developer tools.

These tracks are designed to provide developers with comprehensive insights into their React application’s performance by visualizing React-specific events and metrics alongside other critical data sources such as network requests, JavaScript execution, and event loop activity, all synchronized on a unified timeline within the Performance panel for a complete understanding of application behavior.

React Performance TracksReact Performance Tracks

Usage

React Performance tracks are only available in development and profiling builds of React:

If enabled, tracks should appear automatically in the traces you record with the Performance panel of browsers that provide extensibility APIs.

Pitfall

The profiling instrumentation that powers React Performance tracks adds some additional overhead, so it is disabled in production builds by default.


Tracks

Scheduler

The Scheduler is an internal React concept used for managing tasks with different priorities. This track consists of 4 subtracks, each representing work of a specific priority:

  • Blocking - The synchronous updates, which could’ve been initiated by user interactions.
  • Transition - Non-blocking work that happens in the background, usually initiated via startTransition.
  • Suspense - Work related to Suspense boundaries, such as displaying fallbacks or revealing content.
  • Idle - The lowest priority work that is done when there are no other tasks with higher priority.
Scheduler trackScheduler track

Renders

Every render pass consists of multiple phases that you can see on a timeline:

  • Update - this is what caused a new render pass.
  • Render - React renders the updated subtree by calling render functions of components. You can see the rendered components subtree on Components track, which follows the same color scheme.
  • Commit - After rendering components, React will submit the changes to the DOM and run layout effects, like useLayoutEffect.
  • Remaining Effects - React runs passive effects of a rendered subtree. This usually happens after the paint, and this is when React runs hooks like useEffect. One known exception is user interactions, like clicks, or other discrete events. In this scenario, this phase could run before the paint.
Scheduler track: updatesScheduler track: updates

Learn more about renders and commits.

Cascading updates

Cascading updates is one of the patterns for performance regressions. If an update was scheduled during a render pass, React could discard completed work and start a new pass.

In development builds, React can show you which Component scheduled a new update. This includes both general updates and cascading ones. You can see the enhanced stack trace by clicking on the “Cascading update” entry, which should also display the name of the method that scheduled an update.

Scheduler track: cascading updatesScheduler track: cascading updates

Learn more about Effects.

Components

The Components track visualizes the durations of React components. They are displayed as a flamegraph, where each entry represents the duration of the corresponding component render and all its descendant children components.

Components track: render durationsComponents track: render durations

Similar to render durations, effect durations are also represented as a flamegraph, but with a different color scheme that aligns with the corresponding phase on the Scheduler track.

Components track: effects durationsComponents track: effects durations

Note

Unlike renders, not all effects are shown on the Components track by default.

To maintain performance and prevent UI clutter, React will only display those effects, which had a duration of 0.05ms or longer, or triggered an update.

Additional events may be displayed during the render and effects phases:

  • Mount - A corresponding subtree of component renders or effects was mounted.
  • Unmount - A corresponding subtree of component renders or effects was unmounted.
  • Reconnect - Similar to Mount, but limited to cases when <Activity> is used.
  • Disconnect - Similar to Unmount, but limited to cases when <Activity> is used.

Changed props

In development builds, when you click on a component render entry, you can inspect potential changes in props. You can use this information to identify unnecessary renders.

Components track: changed propsComponents track: changed props