Skip to content

Commit 663e97f

Browse files
committed
docs: initial draft of Tracks section
1 parent b59f74c commit 663e97f

File tree

9 files changed

+56
-15
lines changed

9 files changed

+56
-15
lines changed
421 KB
Loading
437 KB
Loading
328 KB
Loading
263 KB
Loading
408 KB
Loading
426 KB
Loading
373 KB
Loading
407 KB
Loading
Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: React Performance tracks
2+
title: React Performance Tracks
33
version: experimental
44
---
55

@@ -19,21 +19,15 @@ Experimental versions of React may contain bugs. Don't use them in production.
1919

2020
<Intro>
2121

22-
React Performance tracks are specialized custom entries that appear on the [Performance panel's timeline of Chrome DevTools](https://developer.chrome.com/docs/devtools/performance/overview).
22+
React Performance Tracks are specialized custom entries that appear in the Performance panel's timeline.
2323

2424
</Intro>
2525

26-
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.
26+
These tracks provide developers with comprehensive insights into their React application's performance. They visualize React-specific events and metrics alongside other critical data sources such as network requests, JavaScript execution, and Event Loop activity. All data is synchronized on a unified timeline within the Performance panel for a complete understanding of application behavior.
2727

2828
<div style={{display: 'flex', justifyContent: 'center', marginBottom: '1rem'}}>
29-
<picture >
30-
<source srcset="/images/blog/react-labs-april-2025/perf_tracks.png" />
31-
<img className="w-full light-image" src="/images/blog/react-labs-april-2025/perf_tracks.webp" />
32-
</picture>
33-
<picture >
34-
<source srcset="/images/blog/react-labs-april-2025/perf_tracks_dark.png" />
35-
<img className="w-full dark-image" src="/images/blog/react-labs-april-2025/perf_tracks_dark.webp" />
36-
</picture>
29+
<img className="w-full light-image" src="/images/docs/performance-tracks/overview.png" alt="React Performance Tracks" />
30+
<img className="w-full dark-image" src="/images/docs/performance-tracks/overview.dark.png" alt="React Performance Tracks" />
3731
</div>
3832

3933
<InlineToc />
@@ -42,11 +36,11 @@ These tracks are designed to provide developers with comprehensive insights into
4236

4337
## Usage {/*usage*/}
4438

45-
You don't need to do anything to explicitly enable React Performance tracks. They are enabled by default in development and profiling builds of React and should appear by default in the traces you record with the Performance panel.
39+
You don't need to do anything to explicitly enable React Performance Tracks. They are enabled by default in development and profiling builds of React and should appear automatically in the traces you record with the Performance panel of browsers that provide [extensibility APIs](https://developer.chrome.com/docs/devtools/performance/extension).
4640

4741
<Pitfall>
4842

49-
Profiling instrumentation that powers React Performance tracks adds some additional overhead, so it is disabled in the production build by default.
43+
The profiling instrumentation that powers React Performance Tracks adds some additional overhead, so it is disabled in production builds by default.
5044

5145
</Pitfall>
5246

@@ -56,8 +50,55 @@ Profiling instrumentation that powers React Performance tracks adds some additio
5650

5751
### Scheduler {/*scheduler*/}
5852

59-
🚧 Work in progress...
53+
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:
54+
55+
- **Blocking** - The highest priority work that must be finished before the browser can paint.
56+
- **Transition** - Non-blocking work that happens in the background, usually via [`startTransition`](/reference/react/startTransition).
57+
- **Suspense** - Work related to Suspense boundaries, such as displaying fallbacks or revealing content.
58+
- **Idle** - The lowest priority work that is done when there are no other tasks with higher priority.
59+
60+
🚧 `<screenshot>`
61+
62+
#### Updates {/*updates*/}
63+
64+
Every update consists of multiple phases that you can see on a timeline:
65+
66+
- **Render** - React renders the updated subtree by calling render functions of components. You can see the rendered components subtree on [Components track](/learn/react-performance-tracks#components), which follows the same color scheme.
67+
- **Commit** - After rendering components, React will submit the changes to the DOM and run layout effects, like [`useLayoutEffect`](/reference/react/useLayoutEffect).
68+
- **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`](/reference/react/useEffect). One known exception is user interactions, like clicks, or other discrete events. In this scenario, this phase could run before the paint.
69+
70+
🚧 `<screenshot>`
71+
72+
[Learn more about renders and commits](/learn/render-and-commit).
6073

6174
### Components {/*components*/}
6275

63-
🚧 Work in progress...
76+
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.
77+
78+
<div style={{display: 'flex', justifyContent: 'center', marginBottom: '1rem'}}>
79+
<img className="w-full light-image" src="/images/docs/performance-tracks/components-render.png" alt="Components Track: render durations" />
80+
<img className="w-full dark-image" src="/images/docs/performance-tracks/components-render.dark.png" alt="Components Track: render durations" />
81+
</div>
82+
83+
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.
84+
85+
<div style={{display: 'flex', justifyContent: 'center', marginBottom: '1rem'}}>
86+
<img className="w-full light-image" src="/images/docs/performance-tracks/components-effects.png" alt="Components Track: effects durations" />
87+
<img className="w-full dark-image" src="/images/docs/performance-tracks/components-effects.dark.png" alt="Components Track: effects durations" />
88+
</div>
89+
90+
Additional events may be displayed during the render and effects phases:
91+
92+
- <span style={{padding: '0.125rem 0.25rem', backgroundColor: '#facc15', color: '#1f1f1fff'}}>Mount</span> - A corresponding subtree of component renders or effects was mounted.
93+
- <span style={{padding: '0.125rem 0.25rem', backgroundColor: '#facc15', color: '#1f1f1fff'}}>Unmount</span> - A corresponding subtree of component renders or effects was unmounted.
94+
- <span style={{padding: '0.125rem 0.25rem', backgroundColor: '#facc15', color: '#1f1f1fff'}}>Reconnect</span> - Similar to Mount, but limited to cases when [`<Activity>`](/reference/react/Activity) is used.
95+
- <span style={{padding: '0.125rem 0.25rem', backgroundColor: '#facc15', color: '#1f1f1fff'}}>Disconnect</span> - Similar to Unmount, but limited to cases when [`<Activity>`](/reference/react/Activity) is used.
96+
97+
#### Changed props {/*changed-props*/}
98+
99+
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.
100+
101+
<div style={{display: 'flex', justifyContent: 'center', marginBottom: '1rem'}}>
102+
<img className="w-full light-image" src="/images/docs/performance-tracks/changed-props.png" alt="Components Track: changed props" />
103+
<img className="w-full dark-image" src="/images/docs/performance-tracks/changed-props.dark.png" alt="Components Track: changed props" />
104+
</div>

0 commit comments

Comments
 (0)