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

Unfork Lazy Component Branches #13902

Merged
merged 7 commits into from
Oct 20, 2018
Merged

Conversation

sebmarkbage
Copy link
Collaborator

By adding an extra field for reconciliation purposes we can avoid the Lazy special cases. Normally it wouldn't be worth it but we can start using this technique for other things like pure.

@sizebot
Copy link

sizebot commented Oct 20, 2018

ReactDOM: size: -0.3%, gzip: -0.1%

Details of bundled changes.

Comparing: 7268d97...b2ee274

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js -0.2% -0.2% 677.05 KB 675.39 KB 157.31 KB 157.07 KB UMD_DEV
react-dom.production.min.js -0.3% -0.1% 97.43 KB 97.15 KB 31.83 KB 31.78 KB UMD_PROD
react-dom.development.js -0.2% -0.1% 672.39 KB 670.73 KB 155.91 KB 155.68 KB NODE_DEV
react-dom.production.min.js -0.3% -0.2% 97.45 KB 97.17 KB 31.39 KB 31.34 KB NODE_PROD
react-dom-test-utils.development.js -0.3% -0.2% 45.96 KB 45.83 KB 12.47 KB 12.45 KB UMD_DEV
react-dom-test-utils.production.min.js -0.2% -0.1% 10 KB 9.98 KB 3.72 KB 3.72 KB UMD_PROD
react-dom-test-utils.development.js -0.3% -0.2% 45.68 KB 45.55 KB 12.41 KB 12.38 KB NODE_DEV
react-dom-test-utils.production.min.js -0.2% -0.1% 9.77 KB 9.75 KB 3.66 KB 3.65 KB NODE_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 11.01 KB 11.01 KB 3.81 KB 3.81 KB UMD_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 10.75 KB 10.75 KB 3.71 KB 3.71 KB NODE_PROD
react-dom-server.browser.development.js -0.0% -0.0% 107.64 KB 107.64 KB 28.54 KB 28.54 KB UMD_DEV
react-dom-server.browser.development.js -0.0% -0.0% 103.77 KB 103.77 KB 27.54 KB 27.54 KB NODE_DEV
react-dom-server.node.development.js -0.0% -0.0% 105.7 KB 105.69 KB 28.1 KB 28.1 KB NODE_DEV
ReactDOM-dev.js -0.2% -0.2% 690.36 KB 688.68 KB 156.64 KB 156.35 KB FB_WWW_DEV
ReactDOM-prod.js -0.1% -0.2% 293.6 KB 293.42 KB 53.94 KB 53.85 KB FB_WWW_PROD
ReactTestUtils-dev.js -0.3% -0.2% 41.46 KB 41.32 KB 11.17 KB 11.15 KB FB_WWW_DEV
react-dom.profiling.min.js -0.3% -0.1% 99.85 KB 99.57 KB 31.75 KB 31.71 KB NODE_PROFILING
ReactDOM-profiling.js -0.0% -0.1% 298.01 KB 297.92 KB 54.99 KB 54.93 KB FB_WWW_PROFILING
react-dom.profiling.min.js -0.3% -0.2% 99.78 KB 99.5 KB 32.27 KB 32.2 KB UMD_PROFILING

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js -0.4% -0.2% 464.5 KB 462.85 KB 103.11 KB 102.87 KB UMD_DEV
react-art.production.min.js -0.3% -0.2% 89.39 KB 89.11 KB 27.48 KB 27.41 KB UMD_PROD
react-art.development.js -0.4% -0.2% 396.28 KB 394.62 KB 86.01 KB 85.8 KB NODE_DEV
react-art.production.min.js -0.5% -0.3% 54.37 KB 54.08 KB 16.75 KB 16.7 KB NODE_PROD
ReactART-dev.js -0.4% -0.3% 400.62 KB 398.94 KB 84.5 KB 84.22 KB FB_WWW_DEV
ReactART-prod.js -0.1% -0.3% 166.81 KB 166.7 KB 28.26 KB 28.19 KB FB_WWW_PROD

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js -0.6% -0.4% 409.75 KB 407.29 KB 88.85 KB 88.54 KB UMD_DEV
react-test-renderer.production.min.js -1.0% -0.4% 55.83 KB 55.26 KB 17.13 KB 17.06 KB UMD_PROD
react-test-renderer.development.js -0.6% -0.3% 405.32 KB 402.86 KB 87.74 KB 87.45 KB NODE_DEV
react-test-renderer.production.min.js -1.0% -0.5% 55.54 KB 54.97 KB 16.91 KB 16.83 KB NODE_PROD
react-test-renderer-shallow.development.js -0.0% 0.0% 26.66 KB 26.66 KB 7.17 KB 7.17 KB UMD_DEV
react-test-renderer-shallow.development.js -0.0% -0.0% 21.16 KB 21.16 KB 5.75 KB 5.74 KB NODE_DEV
ReactTestRenderer-dev.js -0.6% -0.4% 410 KB 407.56 KB 86.59 KB 86.22 KB FB_WWW_DEV

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js -0.4% -0.2% 393.98 KB 392.32 KB 84.45 KB 84.25 KB NODE_DEV
react-reconciler.production.min.js -0.5% -0.2% 55.41 KB 55.12 KB 16.56 KB 16.54 KB NODE_PROD
react-reconciler-persistent.development.js -0.4% -0.2% 392.59 KB 390.93 KB 83.9 KB 83.69 KB NODE_DEV
react-reconciler-persistent.production.min.js -0.5% -0.2% 55.42 KB 55.13 KB 16.57 KB 16.54 KB NODE_PROD
react-reconciler-reflection.development.js -0.4% -0.3% 16.44 KB 16.37 KB 4.98 KB 4.96 KB NODE_DEV
react-reconciler-reflection.production.min.js 0.0% -0.1% 2.57 KB 2.57 KB 1.14 KB 1.14 KB NODE_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js -0.3% -0.3% 527.22 KB 525.56 KB 115.49 KB 115.19 KB RN_FB_DEV
ReactNativeRenderer-prod.js -0.1% -0.1% 221.6 KB 221.45 KB 38.59 KB 38.54 KB RN_FB_PROD
ReactNativeRenderer-dev.js -0.3% -0.3% 526.93 KB 525.27 KB 115.41 KB 115.12 KB RN_OSS_DEV
ReactNativeRenderer-prod.js -0.1% -0.1% 221.61 KB 221.46 KB 38.59 KB 38.54 KB RN_OSS_PROD
ReactFabric-dev.js -0.3% -0.3% 517.44 KB 515.79 KB 113.06 KB 112.77 KB RN_FB_DEV
ReactFabric-prod.js -0.1% -0.2% 216.18 KB 216.02 KB 37.33 KB 37.26 KB RN_FB_PROD
ReactFabric-dev.js -0.3% -0.3% 517.48 KB 515.82 KB 113.07 KB 112.79 KB RN_OSS_DEV
ReactFabric-prod.js -0.1% -0.2% 216.21 KB 216.05 KB 37.35 KB 37.28 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js -0.0% -0.2% 227.21 KB 227.16 KB 39.96 KB 39.89 KB RN_OSS_PROFILING
ReactFabric-profiling.js -0.0% -0.3% 220.95 KB 220.9 KB 38.65 KB 38.56 KB RN_OSS_PROFILING
ReactNativeRenderer-profiling.js -0.0% -0.2% 227.2 KB 227.14 KB 39.96 KB 39.89 KB RN_FB_PROFILING
ReactFabric-profiling.js -0.0% -0.3% 220.91 KB 220.86 KB 38.64 KB 38.54 KB RN_FB_PROFILING

scheduler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
scheduler.development.js n/a n/a 0 B 19.17 KB 0 B 5.74 KB UMD_DEV
scheduler.production.min.js n/a n/a 0 B 3.16 KB 0 B 1.53 KB UMD_PROD

Generated by 🚫 dangerJS

This will be used to store the wrapped type of an element. E.g. pure and
lazy.

The existing type field will be used for the unwrapped type within them.
Instead, we check if the elementType and type are equal to test if
we need to resolve props. This is slightly slower in the normal case
but will yield less code and branching.
This way we don't have to check the type in a hacky way in the
indeterminate path. Also, lets us deal with lazy that resolves to
indeterminate and such.
mode: TypeOfMode,
expirationTime: ExpirationTime,
): Fiber {
const fiber = createFiberFromElementWithoutDebugInfo(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why the two functions? Doesn't look like this is called anywhere else

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So that I can do early returns in the other one. Compiler can restructure and get rid of it in prod.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe you

child = updateFunctionComponent(
null,
workInProgress,
Component,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we get rid of this argument now?

let child;
switch (resolvedTag) {
case FunctionComponent: {
child = updateFunctionComponent(
Copy link
Collaborator

Choose a reason for hiding this comment

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

These can be early returns

@acdlite
Copy link
Collaborator

acdlite commented Oct 20, 2018

Merging so I can sync to www

@acdlite acdlite merged commit 95a313e into facebook:master Oct 20, 2018
@@ -694,8 +684,6 @@ function completeWork(
break;
}
case ForwardRef:
case ForwardRefLazy:
break;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oops, shouldn't have deleted the break, because now it falls through to SuspenseComponent. I'll revert.

linjiajian999 pushed a commit to linjiajian999/react that referenced this pull request Oct 22, 2018
* Introduce elementType field

This will be used to store the wrapped type of an element. E.g. pure and
lazy.

The existing type field will be used for the unwrapped type within them.

* Store the unwrapped type on the type field of lazy components

* Use the raw tags for lazy components

Instead, we check if the elementType and type are equal to test if
we need to resolve props. This is slightly slower in the normal case
but will yield less code and branching.

* Clean up lazy branches

* Collapse work tag numbering

* Split IndeterminateComponent out from Lazy

This way we don't have to check the type in a hacky way in the
indeterminate path. Also, lets us deal with lazy that resolves to
indeterminate and such.

* Missing clean up in rebase
jetoneza pushed a commit to jetoneza/react that referenced this pull request Jan 23, 2019
* Introduce elementType field

This will be used to store the wrapped type of an element. E.g. pure and
lazy.

The existing type field will be used for the unwrapped type within them.

* Store the unwrapped type on the type field of lazy components

* Use the raw tags for lazy components

Instead, we check if the elementType and type are equal to test if
we need to resolve props. This is slightly slower in the normal case
but will yield less code and branching.

* Clean up lazy branches

* Collapse work tag numbering

* Split IndeterminateComponent out from Lazy

This way we don't have to check the type in a hacky way in the
indeterminate path. Also, lets us deal with lazy that resolves to
indeterminate and such.

* Missing clean up in rebase
NMinhNguyen referenced this pull request in enzymejs/react-shallow-renderer Jan 29, 2020
* Introduce elementType field

This will be used to store the wrapped type of an element. E.g. pure and
lazy.

The existing type field will be used for the unwrapped type within them.

* Store the unwrapped type on the type field of lazy components

* Use the raw tags for lazy components

Instead, we check if the elementType and type are equal to test if
we need to resolve props. This is slightly slower in the normal case
but will yield less code and branching.

* Clean up lazy branches

* Collapse work tag numbering

* Split IndeterminateComponent out from Lazy

This way we don't have to check the type in a hacky way in the
indeterminate path. Also, lets us deal with lazy that resolves to
indeterminate and such.

* Missing clean up in rebase
bvaughn pushed a commit to bvaughn/react that referenced this pull request Dec 1, 2020
Work tags changed recently (PR facebook#13902) but we didn't bump React versions. This meant that DevTools has valid work tags only for master (and FB www sync) but invalid work tags for the latest open source releases. To fix this, I incremneted React's version in Git (without an actual release) and added a new fork to the work tags detection branch.

This commit also adds tags for the experimental Scope and Fundamental APIs to DevTools so component names will at least display correctly. Technically these new APIs were first introduced to experimental builds ~16.9 but I didn't add a new branch to the work tags fork because I don't they're used commonly. I've just added them to the 17+ branches.
bvaughn pushed a commit to bvaughn/react that referenced this pull request Dec 1, 2020
Work tags changed recently (PR facebook#13902) but we didn't bump React versions. This meant that DevTools has valid work tags only for master (and FB www sync) but invalid work tags for the latest open source releases. To fix this, I incremneted React's version in Git (without an actual release) and added a new fork to the work tags detection branch.

This commit also adds tags for the experimental Scope and Fundamental APIs to DevTools so component names will at least display correctly. Technically these new APIs were first introduced to experimental builds ~16.9 but I didn't add a new branch to the work tags fork because I don't they're used commonly. I've just added them to the 17+ branches.
bvaughn pushed a commit to bvaughn/react that referenced this pull request Dec 1, 2020
Work tags changed recently (PR facebook#13902) but we didn't bump React versions. This meant that DevTools has valid work tags only for master (and FB www sync) but invalid work tags for the latest open source releases. To fix this, I incremneted React's version in Git (without an actual release) and added a new fork to the work tags detection branch.

This commit also adds tags for the experimental Scope and Fundamental APIs to DevTools so component names will at least display correctly. Technically these new APIs were first introduced to experimental builds ~16.9 but I didn't add a new branch to the work tags fork because I don't they're used commonly. I've just added them to the 17+ branches.
bvaughn pushed a commit that referenced this pull request Dec 1, 2020
* Fixed invalid DevTools work tags

Work tags changed recently (PR #13902) but we didn't bump React versions. This meant that DevTools has valid work tags only for master (and FB www sync) but invalid work tags for the latest open source releases. To fix this, I incremneted React's version in Git (without an actual release) and added a new fork to the work tags detection branch.

This commit also adds tags for the experimental Scope and Fundamental APIs to DevTools so component names will at least display correctly. Technically these new APIs were first introduced to experimental builds ~16.9 but I didn't add a new branch to the work tags fork because I don't they're used commonly. I've just added them to the 17+ branches.

* Removed FundamentalComponent from DevTools tag defs
bvaughn pushed a commit to bvaughn/react that referenced this pull request Dec 1, 2020
Work tags changed recently (PR facebook#13902) but we didn't bump React versions. This meant that DevTools has valid work tags only for master (and FB www sync) but invalid work tags for the latest open source releases. To fix this, I incremneted React's version in Git (without an actual release) and added a new fork to the work tags detection branch.

This commit also adds tags for the experimental Scope and Fundamental APIs to DevTools so component names will at least display correctly. Technically these new APIs were first introduced to experimental builds ~16.9 but I didn't add a new branch to the work tags fork because I don't they're used commonly. I've just added them to the 17+ branches.
bvaughn pushed a commit to bvaughn/react that referenced this pull request Dec 4, 2020
Work tags changed recently (PR facebook#13902) but we didn't bump React versions. This meant that DevTools has valid work tags only for master (and FB www sync) but invalid work tags for the latest open source releases. To fix this, I incremneted React's version in Git (without an actual release) and added a new fork to the work tags detection branch.

This commit also adds tags for the experimental Scope and Fundamental APIs to DevTools so component names will at least display correctly. Technically these new APIs were first introduced to experimental builds ~16.9 but I didn't add a new branch to the work tags fork because I don't they're used commonly. I've just added them to the 17+ branches.
koto pushed a commit to koto/react that referenced this pull request Jun 15, 2021
* Fixed invalid DevTools work tags

Work tags changed recently (PR facebook#13902) but we didn't bump React versions. This meant that DevTools has valid work tags only for master (and FB www sync) but invalid work tags for the latest open source releases. To fix this, I incremneted React's version in Git (without an actual release) and added a new fork to the work tags detection branch.

This commit also adds tags for the experimental Scope and Fundamental APIs to DevTools so component names will at least display correctly. Technically these new APIs were first introduced to experimental builds ~16.9 but I didn't add a new branch to the work tags fork because I don't they're used commonly. I've just added them to the 17+ branches.

* Removed FundamentalComponent from DevTools tag defs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants