Skip to content

Commit ee8df3b

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

File tree

7 files changed

+35
-13
lines changed

7 files changed

+35
-13
lines changed
328 KB
Loading
263 KB
Loading
408 KB
Loading
426 KB
Loading
373 KB
Loading
407 KB
Loading

src/content/learn/react-performance-tracks.md

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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 on the Performance panel's timeline.
2323

2424
</Intro>
2525

2626
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.
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,36 @@ 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+
🚧 WIP: a sub-section about React update and phases.
6063

6164
### Components {/*components*/}
6265

63-
🚧 Work in progress...
66+
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.
67+
68+
<div style={{display: 'flex', justifyContent: 'center', marginBottom: '1rem'}}>
69+
<img className="w-full light-image" src="/images/docs/performance-tracks/components-render.png" alt="Components Track: render durations" />
70+
<img className="w-full dark-image" src="/images/docs/performance-tracks/components-render.dark.png" alt="Components Track: render durations" />
71+
</div>
72+
73+
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.
74+
75+
<div style={{display: 'flex', justifyContent: 'center', marginBottom: '1rem'}}>
76+
<img className="w-full light-image" src="/images/docs/performance-tracks/components-effects.png" alt="Components Track: effects durations" />
77+
<img className="w-full dark-image" src="/images/docs/performance-tracks/components-effects.dark.png" alt="Components Track: effects durations" />
78+
</div>
79+
80+
Additional events may be displayed during the render and effects phases:
81+
82+
- <span style={{padding: '0.125rem 0.25rem', backgroundColor: '#facc15', color: '#1f1f1fff'}}>Mount</span> - A corresponding subtree of component renders or effects was mounted.
83+
- <span style={{padding: '0.125rem 0.25rem', backgroundColor: '#facc15', color: '#1f1f1fff'}}>Unmount</span> - A corresponding subtree of component renders or effects was unmounted.
84+
- <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.
85+
- <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.

0 commit comments

Comments
 (0)