GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Fiber] Log Component Effects to Performance Track by sebmarkbage · Pull Request #30983 · react/react

Conversation

@sebmarkbage

@sebmarkbage sebmarkbage commented Sep 17, 2024

Copy link
Copy Markdown
Contributor

Stacked on #30981. Same as #30967 but for effects.

This logs a tree of components using performance.measure().

In addition to the previous render phase this logs one tree for each commit phase:

  • Mutation Phase
  • Layout Effect
  • Passive Unmounts
  • Passive Mounts

I currently skip the Before Mutation phase since the snapshots are so unusual it's not worth creating trees for those.

The mechanism is that I reuse the timings we track for enableProfilerCommitHooks. I track first and last effect timestamp within each component subtree. Then on the way up do we log the entry. This means that we don't include overhead to find our way down to a component and that we don't need to add any additional overhead by reading timestamps.

To ensure that the entries get ordered correctly we need to ensure that the start time of each parent is slightly before the inner one.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sebmarkbage
sebmarkbage requested review from acdlite, hoxyq and rickhanlonii September 17, 2024 02:59
@vercel

vercel Bot commented Sep 17, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 17, 2024 8:03pm
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Sep 17, 2024
@vercel
vercel Bot deployed to Preview September 17, 2024 03:02
View deployment
@react-sizebot

react-sizebot commented Sep 17, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Comparing: 15da9174518f18f82869767ebe2a21be2fc8bd90...ea5e88e431595d20b95969223ced78b848e24d2c

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 508.59 kB 508.56 kB = 91.04 kB 91.03 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 513.49 kB 513.49 kB = 91.74 kB 91.74 kB
facebook-www/ReactDOM-prod.classic.js = 602.95 kB 602.92 kB = 106.73 kB 106.73 kB
facebook-www/ReactDOM-prod.modern.js = 579.18 kB 579.18 kB = 102.85 kB 102.85 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-reconciler/cjs/react-reconciler.profiling.js +0.72% 410.49 kB 413.46 kB +0.55% 67.23 kB 67.60 kB
oss-experimental/react-art/cjs/react-art.development.js +0.60% 557.67 kB 561.00 kB +0.46% 90.43 kB 90.84 kB
oss-experimental/react-dom/cjs/react-dom-profiling.profiling.js +0.51% 539.26 kB 542.02 kB +0.35% 96.24 kB 96.57 kB
oss-experimental/react-reconciler/cjs/react-reconciler.development.js +0.50% 639.33 kB 642.51 kB +0.35% 102.93 kB 103.29 kB
oss-experimental/react-dom/cjs/react-dom-client.development.js +0.34% 942.77 kB 945.96 kB +0.22% 159.77 kB 160.12 kB
oss-experimental/react-dom/cjs/react-dom-profiling.development.js +0.34% 959.16 kB 962.40 kB +0.22% 162.59 kB 162.95 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.development.js +0.33% 959.71 kB 962.89 kB +0.22% 163.58 kB 163.94 kB

Generated by 🚫 dangerJS against 3eb822c

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sebmarkbage sebmarkbage mentioned this pull request Sep 17, 2024
[Fiber] Color Performance Track Entries by Self Time #30984
Merged
hoxyq
hoxyq approved these changes Sep 17, 2024
View reviewed changes
@vercel
vercel Bot deployed to Preview September 17, 2024 18:17
View deployment
sebmarkbage added 4 commits September 17, 2024 16:00
@sebmarkbage
Track first and last effect time per component within a phase
9e06139
This lets us build up a tree of effects.
@sebmarkbage
Performance tracks are sorted by start time
d3bf32a
To ensure that parent comes first we subtrack a little bit when we bubble
the start time.
@sebmarkbage
Track the remaining phases in the same way
f85c537
@sebmarkbage
Use export at each declaration
3eb822c
It's getting a lot to duplicate.
@sebmarkbage
sebmarkbage force-pushed the performancemeasure3 branch from a3894dd to 3eb822c Compare September 17, 2024 20:01
@vercel
vercel Bot deployed to Preview September 17, 2024 20:03
View deployment
@sebmarkbage
sebmarkbage merged commit e1c2090 into react:main Sep 17, 2024
github-actions Bot pushed a commit that referenced this pull request Sep 17, 2024
@sebmarkbage
[Fiber] Log Component Effects to Performance Track (#30983)
7b7ffbd
Stacked on #30981. Same as #30967 but for effects.

This logs a tree of components using `performance.measure()`.

In addition to the previous render phase this logs one tree for each
commit phase:

- Mutation Phase
- Layout Effect
- Passive Unmounts
- Passive Mounts

I currently skip the Before Mutation phase since the snapshots are so
unusual it's not worth creating trees for those.

The mechanism is that I reuse the timings we track for
`enableProfilerCommitHooks`. I track first and last effect timestamp
within each component subtree. Then on the way up do we log the entry.
This means that we don't include overhead to find our way down to a
component and that we don't need to add any additional overhead by
reading timestamps.

To ensure that the entries get ordered correctly we need to ensure that
the start time of each parent is slightly before the inner one.

DiffTrain build for [e1c2090](e1c2090)
sebmarkbage added a commit that referenced this pull request Sep 17, 2024
@sebmarkbage
[Fiber] Color Performance Track Entries by Self Time (#30984)
8dfbd16
Stacked on #30983.

This colors each component entry by its self time from light to dark
depending on how long it took. If it took longer than a cut off we color
it red (the error color).

<img width="435" alt="Screenshot 2024-09-16 at 11 48 15 PM"
src="https://github.com/user-attachments/assets/5d0bda83-6205-40e9-bec1-b81db2d48b2d">
github-actions Bot pushed a commit that referenced this pull request Sep 17, 2024
@sebmarkbage
[Fiber] Color Performance Track Entries by Self Time (#30984)
a5e6d67
Stacked on #30983.

This colors each component entry by its self time from light to dark
depending on how long it took. If it took longer than a cut off we color
it red (the error color).

<img width="435" alt="Screenshot 2024-09-16 at 11 48 15 PM"
src="https://github.com/user-attachments/assets/5d0bda83-6205-40e9-bec1-b81db2d48b2d">

DiffTrain build for [8dfbd16](8dfbd16)
@vercel-release-bot vercel-release-bot mentioned this pull request Sep 18, 2024
Upgrade React from a99d8e8d-20240916 to 5dcb0097-20240918 vercel/next.js#70225
Merged
sebmarkbage added a commit to sebmarkbage/react that referenced this pull request Nov 12, 2024
@sebmarkbage
Revert "Performance tracks are sorted by start time" hack
79b5b33
This reverts commit d3bf32a which was part of react#30983
@sebmarkbage sebmarkbage mentioned this pull request Nov 12, 2024
Revert "Performance tracks are sorted by start time" hack #31518
Merged
sebmarkbage added a commit that referenced this pull request Nov 12, 2024
@sebmarkbage
Revert "Performance tracks are sorted by start time" hack (#31518)
d9b3841
This reverts commit d3bf32a which was
part of #30983

When you have very deep trees this trick can cause the top levels to
skew way too much from the real numbers. Creating unbalanced trees.

The bug should have been fixed in Chrome Canary now so that entries
added later are sorted to go first which should've addressed this issue.
@sebmarkbage sebmarkbage mentioned this pull request Dec 15, 2024
[Fiber] Log Effect and Render Times in Offscreen Commit Phase #31788
Merged
sebmarkbage added a commit that referenced this pull request Dec 18, 2024
@sebmarkbage
[Fiber] Log Effect and Render Times in Offscreen Commit Phase (#31788)
6a4b46c
In #30967 and
#30983 I added logging of the just
rendered components and the effects. However this didn't consider the
special Offscreen passes. So this adds the same thing to those passes.

Log component effect timings for disconnected/reconnected offscreen
subtrees. This includes initial mount of a Suspense boundary.

Log component render timings for reconnected and already offscreen
offscreen subtrees.
github-actions Bot pushed a commit that referenced this pull request Dec 18, 2024
@sebmarkbage
[Fiber] Log Effect and Render Times in Offscreen Commit Phase (#31788)
740cf06
In #30967 and
#30983 I added logging of the just
rendered components and the effects. However this didn't consider the
special Offscreen passes. So this adds the same thing to those passes.

Log component effect timings for disconnected/reconnected offscreen
subtrees. This includes initial mount of a Suspense boundary.

Log component render timings for reconnected and already offscreen
offscreen subtrees.

DiffTrain build for [6a4b46c](6a4b46c)
github-actions Bot pushed a commit that referenced this pull request Dec 18, 2024
@sebmarkbage
[Fiber] Log Effect and Render Times in Offscreen Commit Phase (#31788)
b34b7cf
In #30967 and
#30983 I added logging of the just
rendered components and the effects. However this didn't consider the
special Offscreen passes. So this adds the same thing to those passes.

Log component effect timings for disconnected/reconnected offscreen
subtrees. This includes initial mount of a Suspense boundary.

Log component render timings for reconnected and already offscreen
offscreen subtrees.

DiffTrain build for [6a4b46c](6a4b46c)
github-actions Bot pushed a commit to code/lib-react that referenced this pull request Dec 18, 2024
@pull
[Fiber] Log Effect and Render Times in Offscreen Commit Phase (react#…
dcc30de
…31788)

In react#30967 and
react#30983 I added logging of the just
rendered components and the effects. However this didn't consider the
special Offscreen passes. So this adds the same thing to those passes.

Log component effect timings for disconnected/reconnected offscreen
subtrees. This includes initial mount of a Suspense boundary.

Log component render timings for reconnected and already offscreen
offscreen subtrees.

DiffTrain build for [6a4b46c](react@6a4b46c)
github-actions Bot pushed a commit to code/lib-react that referenced this pull request Dec 18, 2024
@pull
[Fiber] Log Effect and Render Times in Offscreen Commit Phase (react#…
3fa9439
…31788)

In react#30967 and
react#30983 I added logging of the just
rendered components and the effects. However this didn't consider the
special Offscreen passes. So this adds the same thing to those passes.

Log component effect timings for disconnected/reconnected offscreen
subtrees. This includes initial mount of a Suspense boundary.

Log component render timings for reconnected and already offscreen
offscreen subtrees.

DiffTrain build for [6a4b46c](react@6a4b46c)
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@sebmarkbage
[Fiber] Log Component Effects to Performance Track (react#30983)
0fab722
Stacked on react#30981. Same as react#30967 but for effects.

This logs a tree of components using `performance.measure()`.

In addition to the previous render phase this logs one tree for each
commit phase:

- Mutation Phase
- Layout Effect
- Passive Unmounts
- Passive Mounts

I currently skip the Before Mutation phase since the snapshots are so
unusual it's not worth creating trees for those.

The mechanism is that I reuse the timings we track for
`enableProfilerCommitHooks`. I track first and last effect timestamp
within each component subtree. Then on the way up do we log the entry.
This means that we don't include overhead to find our way down to a
component and that we don't need to add any additional overhead by
reading timestamps.

To ensure that the entries get ordered correctly we need to ensure that
the start time of each parent is slightly before the inner one.
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@sebmarkbage
[Fiber] Color Performance Track Entries by Self Time (react#30984)
ebd9a12
Stacked on react#30983.

This colors each component entry by its self time from light to dark
depending on how long it took. If it took longer than a cut off we color
it red (the error color).

<img width="435" alt="Screenshot 2024-09-16 at 11 48 15 PM"
src="https://github.com/user-attachments/assets/5d0bda83-6205-40e9-bec1-b81db2d48b2d">
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@sebmarkbage
Revert "Performance tracks are sorted by start time" hack (react#31518)
c8431b2
This reverts commit d3bf32a which was
part of react#30983

When you have very deep trees this trick can cause the top levels to
skew way too much from the real numbers. Creating unbalanced trees.

The bug should have been fixed in Chrome Canary now so that entries
added later are sorted to go first which should've addressed this issue.
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@sebmarkbage
[Fiber] Log Effect and Render Times in Offscreen Commit Phase (react#…
386b21b
…31788)

In react#30967 and
react#30983 I added logging of the just
rendered components and the effects. However this didn't consider the
special Offscreen passes. So this adds the same thing to those passes.

Log component effect timings for disconnected/reconnected offscreen
subtrees. This includes initial mount of a Suspense boundary.

Log component render timings for reconnected and already offscreen
offscreen subtrees.

This branch was successfully deployed

1 active deployment
Preview — 3eb822c4 Deployed Sep 17, 2024 by vercel[bot]
View deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hoxyq hoxyq hoxyq approved these changes
@rickhanlonii rickhanlonii Awaiting requested review from rickhanlonii
@acdlite acdlite Awaiting requested review from acdlite

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@sebmarkbage @react-sizebot @hoxyq @facebook-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.