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 — Remove invokeGuardedCallback from commit phase by gaearon · Pull Request #21666 · react/react

Conversation

@gaearon

@gaearon gaearon commented Jun 11, 2021 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Collaborator

Alternative to #21658.

The reason we have this in the first place is to make "pause on uncaught exceptions" work. That's a development feature. However, the way we do this now, especially after the effect traversal refactor, causes quite a bit of a DEV slowdown in commit phase. This makes it harder to have an accurate sense of how slow a render/commit is. While DEV isn't meant to be representative of real perf, it's bad that commits seem disproportionally expensive because of this. It also legitimately slows down the app in development on its own. So we have a devx fix making devx worse. Which is important? I'd say it's not worth it.

Seb proposed that we just remove this and use the prod path in the commit phase. This PR does that.

Example DEV perf difference

This is on a very shallow tree (1 level deep) but with many host children.

Commit before: 10ms

Screenshot 2021-06-11 at 22 42 24

Commit after: 0.1ms

Screenshot 2021-06-11 at 22 41 49

I expect this to also show up in deeper trees, especially the ones with lots of effects etc.

Sorry, something went wrong.

Uh oh!

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

apostolos reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jun 11, 2021
@gaearon
gaearon requested review from acdlite, bvaughn and sebmarkbage June 11, 2021 21:14
@sizebot

sizebot commented Jun 11, 2021 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Comparing: 101ea9f...4556567

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.min.js = 127.08 kB 127.08 kB = 40.74 kB 40.75 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 129.89 kB 129.89 kB = 41.67 kB 41.67 kB
facebook-www/ReactDOM-prod.classic.js = 405.00 kB 405.00 kB = 74.93 kB 74.92 kB
facebook-www/ReactDOM-prod.modern.js = 393.35 kB 393.35 kB = 73.11 kB 73.10 kB
facebook-www/ReactDOMForked-prod.classic.js = 405.00 kB 405.00 kB = 74.93 kB 74.93 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
facebook-www/ReactDOM-dev.classic.js = 1,062.33 kB 1,060.16 kB = 235.47 kB 235.23 kB
facebook-www/ReactDOMForked-dev.classic.js = 1,062.33 kB 1,060.16 kB = 235.47 kB 235.23 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.development.js = 697.53 kB 696.09 kB = 148.58 kB 148.35 kB
oss-stable/react-reconciler/cjs/react-reconciler.development.js = 697.53 kB 696.09 kB = 148.58 kB 148.35 kB
facebook-www/ReactDOM-dev.modern.js = 1,037.44 kB 1,035.28 kB = 230.46 kB 230.21 kB
facebook-www/ReactDOMForked-dev.modern.js = 1,037.44 kB 1,035.28 kB = 230.45 kB 230.21 kB
oss-experimental/react-art/cjs/react-art.development.js = 660.72 kB 659.28 kB = 143.21 kB 143.04 kB
oss-stable-semver/react-art/cjs/react-art.development.js = 638.25 kB 636.82 kB = 138.45 kB 138.26 kB
oss-stable/react-art/cjs/react-art.development.js = 638.25 kB 636.82 kB = 138.45 kB 138.26 kB
react-native/implementations/ReactNativeRenderer-dev.fb.js = 733.22 kB 731.35 kB = 158.35 kB 158.13 kB
react-native/implementations/ReactFabric-dev.fb.js = 715.46 kB 713.59 kB = 154.00 kB 153.77 kB
facebook-www/ReactART-dev.classic.js = 710.60 kB 708.44 kB = 151.56 kB 151.22 kB
facebook-www/ReactART-dev.modern.js = 700.31 kB 698.14 kB = 149.50 kB 149.15 kB
facebook-www/ReactTestRenderer-dev.modern.js = 635.02 kB 631.59 kB = 136.58 kB 135.87 kB
facebook-www/ReactTestRenderer-dev.classic.js = 635.01 kB 631.58 kB = 136.57 kB 135.86 kB
oss-experimental/react-test-renderer/umd/react-test-renderer.development.js = 657.23 kB 647.80 kB = 139.00 kB 136.32 kB
oss-experimental/react-test-renderer/cjs/react-test-renderer.development.js = 626.57 kB 617.48 kB = 137.44 kB 134.83 kB
oss-stable-semver/react-test-renderer/umd/react-test-renderer.development.js = 640.46 kB 631.03 kB = 135.55 kB 132.88 kB
oss-stable/react-test-renderer/umd/react-test-renderer.development.js = 640.46 kB 631.03 kB = 135.55 kB 132.88 kB
oss-stable-semver/react-test-renderer/cjs/react-test-renderer.development.js = 610.64 kB 601.55 kB = 134.03 kB 131.40 kB
oss-stable/react-test-renderer/cjs/react-test-renderer.development.js = 610.64 kB 601.55 kB = 134.03 kB 131.40 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-dev.js = 622.35 kB 612.66 kB = 135.16 kB 132.43 kB

Generated by 🚫 dangerJS against 4556567

All reactions

Sorry, something went wrong.

Uh oh!

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

gaearon
gaearon commented Jun 11, 2021
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js
} catch (error) {
captureCommitPhaseError(fiber, fiber.return, error);
}
setCurrentDebugFiberInDEV(fiber);

@gaearon gaearon Jun 11, 2021

Copy link
Copy Markdown
Collaborator Author

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.

Note: this is OK to call outside DEV.

Sorry, something went wrong.

Uh oh!

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

All reactions
@gaearon

gaearon commented Jun 11, 2021

Copy link
Copy Markdown
Collaborator Author

So I tested this in non-synthetic case just to be sure.

Here's results from a real app rendering a (relative small) data table on input change.

Before:

Screenshot 2021-06-12 at 00 46 00

After:

Screenshot 2021-06-12 at 00 37 46

It cut down rendering per keystroke from 1.2s to 300ms, so 4x DEV improvement for a common interaction.

And a 100x absolute improvement. :)

All reactions

Sorry, something went wrong.

Uh oh!

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

sebmarkbage
sebmarkbage approved these changes Jun 14, 2021
View reviewed changes
gaearon added 2 commits June 14, 2021 21:11
@gaearon
Remove invokeGuardedCallback from commit phase
c272332
@gaearon
Sync fork
4556567
@gaearon
gaearon force-pushed the no-igc branch from 999cc90 to 4556567 Compare June 14, 2021 20:11
@gaearon
gaearon merged commit a8f5e77 into react:master Jun 14, 2021
@gaearon
gaearon deleted the no-igc branch June 14, 2021 20:45
koto pushed a commit to koto/react that referenced this pull request Jun 15, 2021
@gaearon @koto
Remove invokeGuardedCallback from commit phase (react#21666)
e68848e
* Remove invokeGuardedCallback from commit phase

* Sync fork
@acdlite acdlite mentioned this pull request Jun 15, 2021
Move guarded callback closer to usage #21658
Closed
@eps1lon eps1lon mentioned this pull request Jun 22, 2021
React 18: Error boundaries actually catches errors in effects #21712
Closed
eps1lon added a commit to eps1lon/react that referenced this pull request Jun 22, 2021
@eps1lon
Revert "Remove invokeGuardedCallback from commit phase (react#21666)"
8c45676
This reverts commit a8f5e77.
@eps1lon eps1lon mentioned this pull request Jun 22, 2021
Revert "Remove invokeGuardedCallback from commit phase" #21720
Closed
@eps1lon

eps1lon commented Jun 22, 2021

Copy link
Copy Markdown
Collaborator

This changed how errors thrown in effects are handled if they were children of an Error Boundary. Previously they were logged to the console and triggered the error overlay in an Error Boundary. With this change the error is no longer logged and triggers no error overlay which is different compared to errors thrown when rendering. #21712 has more context.

All reactions

Sorry, something went wrong.

Uh oh!

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

facebook-github-bot pushed a commit to react/react-native that referenced this pull request Jun 22, 2021
@kacieb @facebook-github-bot
React Native sync for revisions c96b78e...568dc35
d4d22fb
Summary:
This sync includes the following changes:
- **[43f4cc1](react/react@43f4cc160 )**: Fix failing test ([#21697](react/react#21697)) //<Dan Abramov>//
- **[d0f348d](react/react@d0f348dc1 )**: Fix for failed Suspense layout semantics ([#21694](react/react#21694)) //<Brian Vaughn>//
- **[bd0a963](react/react@bd0a96344 )**: Throw when `act` is used in production ([#21686](react/react#21686)) //<Andrew Clark>//
- **[9343f87](react/react@9343f8720 )**: Use the server src files as entry points for the builds/tests ([#21683](react/react#21683)) //<Sebastian Markbåge>//
- **[502f8a2](react/react@502f8a2a0 )**: [Fizz/Flight] Don't use default args ([#21681](react/react#21681)) //<Sebastian Markbåge>//
- **[a8f5e77](react/react@a8f5e77b9 )**: Remove invokeGuardedCallback from commit phase ([#21666](react/react#21666)) //<Dan Abramov>//
- **[dbe3363](react/react@dbe3363cc )**: [Fizz] Implement Legacy renderToString and renderToNodeStream on top of Fizz ([#21276](react/react#21276)) //<Sebastian Markbåge>//
- **[101ea9f](react/react@101ea9f55 )**: Set deletedTreeCleanUpLevel to 3 ([#21679](react/react#21679)) //<Dan Abramov>//
- **[1a106bd](react/react@1a106bdc2 )**: Wrap eventhandle-specific logic in a flag ([#21657](react/react#21657)) //<Dan Abramov>//
- **[cb30388](react/react@cb30388d1 )**: Export React Native `AttributeType` Types ([#21661](react/react#21661)) //<Timothy Yung>//
- **[c153679](react/react@c1536795c )**: Revert "Make enableSuspenseLayoutEffectSemantics static for www ([#21617](react/react#21617))" ([#21656](react/react#21656)) //<Sebastian Markbåge>//

Changelog:
[General][Changed] - React Native sync for revisions c96b78e...568dc35

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D29303157

fbshipit-source-id: 90952885eb2264f4effa04070357b80700bb9be3
@gaearon gaearon mentioned this pull request Jun 22, 2021
Log and show error overlay for commit phase errors #21723
Merged
@krassowski krassowski mentioned this pull request Jan 2, 2023
Debugger freezes UI on namespace updates when there are many variables jupyterlab/jupyterlab#13694
Closed
@sebmarkbage sebmarkbage mentioned this pull request Apr 6, 2023
[Float][Fiber] Enable Float methods to be called outside of render #26557
Merged
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
@gaearon
Remove invokeGuardedCallback from commit phase (react#21666)
f8d7ff8
* Remove invokeGuardedCallback from commit phase

* Sync fork
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@gaearon
Remove invokeGuardedCallback from commit phase (react#21666)
16a2cba
* Remove invokeGuardedCallback from commit phase

* Sync fork
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bvaughn bvaughn Awaiting requested review from bvaughn
@acdlite acdlite Awaiting requested review from acdlite
1 more reviewer
@sebmarkbage sebmarkbage sebmarkbage 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

@gaearon @sizebot @eps1lon @sebmarkbage @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.