Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effects list refactor continued: did-bailout flag #19322

Merged
merged 18 commits into from
Jul 16, 2020

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Jul 11, 2020

Builds on top of #19261

  • Adds an explicit "did bailout" flag rather than checking whether or not children were cloned.
  • Updates subtreeTag to use its own meta values rather than copying effectTag values.

View only the delta.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jul 11, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 11, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b044185:

Sandbox Source
React Configuration

@sizebot
Copy link

sizebot commented Jul 11, 2020

Details of bundled changes.

Comparing: 61dd00d...b044185

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js 0.0% 0.0% 881.08 KB 881.14 KB 201.79 KB 201.82 KB NODE_DEV
ReactDOMForked-prod.js 🔺+0.2% 🔺+0.4% 404.37 KB 405.35 KB 74.7 KB 74.99 KB FB_WWW_PROD
react-dom-server.node.development.js 0.0% 0.0% 137.33 KB 137.33 KB 36.47 KB 36.48 KB NODE_DEV
react-dom.production.min.js 0.0% 0.0% 118.93 KB 118.93 KB 38.23 KB 38.23 KB NODE_PROD
ReactDOMForked-profiling.js +0.4% +0.4% 415.05 KB 416.61 KB 76.45 KB 76.79 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 143.45 KB 143.45 KB 36.68 KB 36.68 KB UMD_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 20.25 KB 20.25 KB 7.6 KB 7.6 KB NODE_PROD
react-dom-test-utils.production.min.js 0.0% 0.0% 10.34 KB 10.34 KB 4.06 KB 4.06 KB UMD_PROD
ReactDOMTesting-dev.js 0.0% 0.0% 981.67 KB 981.72 KB 219.6 KB 219.63 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% 0.0% 51.13 KB 51.13 KB 14.89 KB 14.9 KB NODE_DEV
ReactDOMTesting-prod.js 0.0% 0.0% 412.26 KB 412.26 KB 77.35 KB 77.35 KB FB_WWW_PROD
react-dom-test-utils.production.min.js 0.0% 0.0% 10.19 KB 10.19 KB 3.98 KB 3.98 KB NODE_PROD
react-dom.development.js 0.0% 0.0% 925.65 KB 925.71 KB 204.19 KB 204.21 KB UMD_DEV
react-dom.production.min.js 0.0% 0.0% 118.8 KB 118.8 KB 39 KB 39 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 122.72 KB 122.72 KB 40.15 KB 40.15 KB UMD_PROFILING
ReactDOMForked-dev.js +0.5% +0.4% 1000.35 KB 1004.93 KB 223.07 KB 223.92 KB FB_WWW_DEV
react-dom.profiling.min.js 0.0% 0.0% 122.98 KB 122.98 KB 39.44 KB 39.44 KB NODE_PROFILING
react-dom-server.browser.production.min.js 0.0% 0.0% 19.91 KB 19.91 KB 7.46 KB 7.46 KB UMD_PROD
ReactDOM-dev.js 0.0% 0.0% 1014.27 KB 1014.32 KB 225.31 KB 225.34 KB FB_WWW_DEV
react-dom-server.browser.development.js 0.0% 0.0% 136.06 KB 136.06 KB 36.22 KB 36.23 KB NODE_DEV
ReactDOM-profiling.js 0.0% 0.0% 420 KB 420 KB 77.44 KB 77.44 KB FB_WWW_PROFILING
react-dom-server.browser.production.min.js 0.0% 0.0% 19.83 KB 19.83 KB 7.44 KB 7.44 KB NODE_PROD
ReactDOMServer-dev.js 0.0% 0.0% 147.36 KB 147.36 KB 37.42 KB 37.42 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% 0.0% 47.56 KB 47.56 KB 11.14 KB 11.14 KB FB_WWW_PROD
react-dom-test-utils.development.js 0.0% 0.0% 55.52 KB 55.52 KB 15.36 KB 15.36 KB UMD_DEV

ReactDOM: size: 0.0%, gzip: 0.0%

Size changes (stable)

Generated by 🚫 dangerJS against b044185

@sizebot
Copy link

sizebot commented Jul 11, 2020

Details of bundled changes.

Comparing: 61dd00d...b044185

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js 0.0% 0.0% 913.62 KB 913.68 KB 207.67 KB 207.7 KB NODE_DEV
ReactDOMForked-prod.js 🔺+0.2% 🔺+0.4% 393.25 KB 394.22 KB 73.18 KB 73.46 KB FB_WWW_PROD
react-dom-server.node.development.js 0.0% 0.0% 138.84 KB 138.84 KB 36.68 KB 36.68 KB NODE_DEV
react-dom.production.min.js 0.0% 0.0% 123.68 KB 123.68 KB 39.63 KB 39.64 KB NODE_PROD
ReactDOMForked-profiling.js +0.4% +0.4% 403.87 KB 405.42 KB 74.92 KB 75.25 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 145.04 KB 145.04 KB 36.88 KB 36.88 KB UMD_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 20.71 KB 20.71 KB 7.67 KB 7.67 KB NODE_PROD
react-dom-test-utils.production.min.js 0.0% 0.0% 10.35 KB 10.35 KB 4.07 KB 4.07 KB UMD_PROD
ReactDOMTesting-dev.js 0.0% 0.0% 953.54 KB 953.6 KB 213.71 KB 213.74 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% 0.0% 51.15 KB 51.15 KB 14.9 KB 14.9 KB NODE_DEV
ReactDOMTesting-prod.js 0.0% 0.0% 398.88 KB 398.88 KB 75.46 KB 75.46 KB FB_WWW_PROD
react-dom-unstable-fizz.node.development.js 0.0% +0.1% 5.61 KB 5.61 KB 1.86 KB 1.87 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 10.2 KB 10.2 KB 3.99 KB 3.99 KB NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.2% 5.36 KB 5.36 KB 1.8 KB 1.81 KB UMD_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.3% 1.17 KB 1.17 KB 665 B 667 B NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.3% 1.2 KB 1.2 KB 705 B 707 B UMD_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 4.87 KB 4.87 KB 1.7 KB 1.71 KB NODE_DEV
react-dom.development.js 0.0% 0.0% 959.63 KB 959.69 KB 210.19 KB 210.21 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.5% 1.01 KB 1.01 KB 615 B 618 B NODE_PROD
react-dom.production.min.js 0.0% 0.0% 123.49 KB 123.49 KB 40.42 KB 40.43 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 127.44 KB 127.44 KB 41.64 KB 41.64 KB UMD_PROFILING
ReactDOMForked-dev.js +0.5% +0.4% 974.82 KB 979.4 KB 217.87 KB 218.71 KB FB_WWW_DEV
react-dom.profiling.min.js 0.0% 0.0% 127.8 KB 127.8 KB 40.89 KB 40.89 KB NODE_PROFILING
react-dom-server.browser.production.min.js 0.0% 0.0% 20.37 KB 20.37 KB 7.54 KB 7.54 KB UMD_PROD
ReactDOM-dev.js 0.0% 0.0% 988.73 KB 988.79 KB 220.11 KB 220.14 KB FB_WWW_DEV
react-dom-server.browser.development.js 0.0% 0.0% 137.57 KB 137.57 KB 36.43 KB 36.43 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 20.29 KB 20.29 KB 7.52 KB 7.52 KB NODE_PROD
ReactDOMServer-prod.js 0.0% 0.0% 46.7 KB 46.7 KB 10.92 KB 10.92 KB FB_WWW_PROD
react-dom-test-utils.development.js 0.0% 0.0% 55.53 KB 55.53 KB 15.37 KB 15.37 KB UMD_DEV

ReactDOM: size: 0.0%, gzip: 0.0%

Size changes (experimental)

Generated by 🚫 dangerJS against b044185

@bvaughn bvaughn mentioned this pull request Jul 11, 2020
@bvaughn bvaughn force-pushed the effects_list_refactor_bailout_flag branch from 0d1a83e to 7171494 Compare July 11, 2020 16:44
@acdlite
Copy link
Collaborator

acdlite commented Jul 13, 2020

Overall the implementation looks right, exactly what I had expected. 👍

There are a few other bailout cases in begin phase where we need to set the DidBailout flag. Like:

// Something suspended and we should still be in dehydrated mode.
// Leave the existing child in place.
workInProgress.child = current.child;
// The dehydrated completion pass expects this flag to be there
// but the normal suspense pass doesn't.
workInProgress.effectTag |= DidCapture;
return null;

Basically anywhere there's a return null inside ReactFiberBeginWork. Maybe we should replace all of them with a function call, with a name like reuseCurrentChild.

export const DidBailout = /* */ 0b0001;
export const BeforeMutation = /* */ 0b0010;
export const Mutation = /* */ 0b0100;
export const Layout = /* */ 0b1000;
Copy link
Collaborator

Choose a reason for hiding this comment

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

As a follow up, we should move the Incomplete, ShouldCapture, and DidCapture flags to this new field.

This was referenced Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants