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] Set profiler values to doubles by sebmarkbage · Pull Request #30942 · react/react

Conversation

@sebmarkbage

@sebmarkbage sebmarkbage commented Sep 11, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

At some point this trick was added to initialize the value first to NaN and then replace them with zeros and negative ones.

This is to address the issue noted in #14365 where these hidden classes can be initialized to SMIs at first and then deopt when we realize they're actually doubles.

However, this fix has been long broken and has deopted the profiling build for years because closure compiler optimizes out the first write.

I'm not sure because I haven't A/B-tested this in the JIT yet but I think we can use negative zero and -1.1 as the initial values instead since they're not simple integers. Negative zero === zero (but not Object.is) so is the same as far as our code is concerned. The negative value is just < 0 comparisons.

Sorry, something went wrong.

Uh oh!

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

All reactions
@sebmarkbage
Set profiler values to doubles
87b3818
@sebmarkbage
sebmarkbage requested review from acdlite, gnoff and kassens September 11, 2024 00:31
@vercel

vercel Bot commented Sep 11, 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 11, 2024 0:33am
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 11, 2024
@vercel
vercel Bot deployed to Preview September 11, 2024 00:33
View deployment
@react-sizebot

react-sizebot commented Sep 11, 2024

Copy link
Copy Markdown

Comparing: bac33d1f82d9094b45d6f662dd7fa895abab8bce...2dff09c183eafbe948c6920030d95da87ea800bd

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 = 505.22 kB 505.22 kB = 90.29 kB 90.29 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 = 512.56 kB 512.56 kB = 91.52 kB 91.52 kB
facebook-www/ReactDOM-prod.classic.js = 600.88 kB 600.88 kB = 106.29 kB 106.29 kB
facebook-www/ReactDOM-prod.modern.js = 577.17 kB 577.17 kB = 102.43 kB 102.43 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 87b3818

All reactions

Sorry, something went wrong.

Uh oh!

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

@rickhanlonii

rickhanlonii commented Sep 11, 2024

Copy link
Copy Markdown
Contributor

I've also noticed that the effects in the profiling builds are like 2x as slow or more because of the time spent in the recordLayoutEffectsDuration and recordLayoutEffectsDuration functions

https://github.com/facebook/react/blob/6ddcbd4f96cb103de3978617a53c200baf5b546c/packages/react-reconciler/src/ReactProfilerTimer.js#L133

I assumed that this is because we're searching back up the tree for the Profiler component to store the duration on, but would this also depot, because this.stateNode.effectDuration isn't defined until it's dynamically set:

https://github.com/facebook/react/blob/8d68da3f7396064614f34b84881fe8833b6039ac/packages/react-reconciler/src/ReactFiber.js#L827-L830

All reactions

Sorry, something went wrong.

Uh oh!

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

@sebmarkbage

sebmarkbage commented Sep 11, 2024

Copy link
Copy Markdown
Contributor Author

The stateNode is always created as a pointer field in createFiber. It’s just updated later. So that should be fine.

rickhanlonii reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

kassens
kassens approved these changes Sep 13, 2024
View reviewed changes

@kassens kassens left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

Build diff view doesn't load (500) but your description makes sense.

Sorry, something went wrong.

Uh oh!

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

All reactions
@sebmarkbage
sebmarkbage merged commit 94e4aca into react:main Sep 13, 2024
github-actions Bot pushed a commit that referenced this pull request Sep 13, 2024
@sebmarkbage
[Fiber] Set profiler values to doubles (#30942)
03205d9
At some point this trick was added to initialize the value first to NaN
and then replace them with zeros and negative ones.

This is to address the issue noted in
#14365 where these hidden
classes can be initialized to SMIs at first and then deopt when we
realize they're actually doubles.

However, this fix has been long broken and has deopted the profiling
build for years because closure compiler optimizes out the first write.

I'm not sure because I haven't A/B-tested this in the JIT yet but I
think we can use negative zero and -1.1 as the initial values instead
since they're not simple integers. Negative zero `===` zero (but not
Object.is) so is the same as far as our code is concerned. The negative
value is just `< 0` comparisons.

DiffTrain build for commit 94e4aca.
github-actions Bot pushed a commit that referenced this pull request Sep 13, 2024
@sebmarkbage
[Fiber] Set profiler values to doubles (#30942)
037b2e3
At some point this trick was added to initialize the value first to NaN
and then replace them with zeros and negative ones.

This is to address the issue noted in
#14365 where these hidden
classes can be initialized to SMIs at first and then deopt when we
realize they're actually doubles.

However, this fix has been long broken and has deopted the profiling
build for years because closure compiler optimizes out the first write.

I'm not sure because I haven't A/B-tested this in the JIT yet but I
think we can use negative zero and -1.1 as the initial values instead
since they're not simple integers. Negative zero `===` zero (but not
Object.is) so is the same as far as our code is concerned. The negative
value is just `< 0` comparisons.

DiffTrain build for [94e4aca](94e4aca)
This was referenced Sep 16, 2024
Upgrade React from 206df66e-20240912 to ee1a403a-20240916 vercel/next.js#70158
Closed
Upgrade React from 206df66e-20240912 to f2df5694-20240916 vercel/next.js#70159
Closed
Upgrade React from 206df66e-20240912 to a99d8e8d-20240916 vercel/next.js#70190
Merged
eps1lon pushed a commit to vercel/next.js that referenced this pull request Sep 18, 2024
@vercel-release-bot
Upgrade React from 206df66e-20240912 to a99d8e8d-20240916 (#70190)
5791706
**breaking change for canary users: Bumps peer dependency of React from
`19.0.0-rc-206df66e-20240912` to `19.0.0-rc-a99d8e8d-20240916`**

[diff
react/react@206df66e...a99d8e8d](react/react@206df66...a99d8e8)

<details>
<summary>React upstream changes</summary>

- react/react#30977
- react/react#30971
- react/react#30922
- react/react#30917
- react/react#30902
- react/react#30912
- react/react#30970
- react/react#30969
- react/react#30967
- react/react#30966
- react/react#30960
- react/react#30968
- react/react#30961
- react/react#28255
- react/react#30957
- react/react#30958
- react/react#30959
- react/react#30951
- react/react#30954
- react/react#30920
- react/react#30942

</details>
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@sebmarkbage
[Fiber] Set profiler values to doubles (react#30942)
c58d819
At some point this trick was added to initialize the value first to NaN
and then replace them with zeros and negative ones.

This is to address the issue noted in
react#14365 where these hidden
classes can be initialized to SMIs at first and then deopt when we
realize they're actually doubles.

However, this fix has been long broken and has deopted the profiling
build for years because closure compiler optimizes out the first write.

I'm not sure because I haven't A/B-tested this in the JIT yet but I
think we can use negative zero and -1.1 as the initial values instead
since they're not simple integers. Negative zero `===` zero (but not
Object.is) so is the same as far as our code is concerned. The negative
value is just `< 0` comparisons.

This branch was successfully deployed

1 active deployment
Preview — 87b38184 Deployed Sep 11, 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

@gnoff gnoff Awaiting requested review from gnoff
@acdlite acdlite Awaiting requested review from acdlite
1 more reviewer
@kassens kassens kassens approved these changes
Reviewers whose approvals may not affect merge requirements

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.

5 participants

@sebmarkbage @react-sizebot @rickhanlonii @kassens @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.