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

Centralize props memoization #13900

Merged
merged 2 commits into from
Oct 20, 2018
Merged

Conversation

sebmarkbage
Copy link
Collaborator

We compare pendingProps against memoizedProps in beginWork so we already have strong assumptions that can't vary by branch. So we can simplify this which lets us get rid of the special case in lazy.

We always call this at the end. This is now enforced to line up since
we do the equality check in the beginning of beginWork. So we can't
have special cases.
@@ -314,7 +311,6 @@ function updateMode(
nextChildren,
renderExpirationTime,
);
memoizeProps(workInProgress, nextChildren);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This one is interesting because it doesn't memoize its props. Only its children. This is a bug since it won't bail out ever.

@sizebot
Copy link

sizebot commented Oct 20, 2018

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

Details of bundled changes.

Comparing: fa65c58...15930b9

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js -0.2% -0.1% 677.48 KB 676.21 KB 157.36 KB 157.16 KB UMD_DEV
react-dom.production.min.js -0.4% -0.3% 97.69 KB 97.33 KB 31.88 KB 31.8 KB UMD_PROD
react-dom.development.js -0.2% -0.1% 672.82 KB 671.55 KB 155.96 KB 155.76 KB NODE_DEV
react-dom.production.min.js -0.4% -0.2% 97.71 KB 97.34 KB 31.44 KB 31.38 KB NODE_PROD
ReactDOM-dev.js -0.2% -0.1% 690.83 KB 689.57 KB 156.65 KB 156.47 KB FB_WWW_DEV
ReactDOM-prod.js -0.7% -0.2% 295.66 KB 293.56 KB 53.91 KB 53.78 KB FB_WWW_PROD
react-dom.profiling.min.js -0.4% -0.2% 100.11 KB 99.74 KB 31.79 KB 31.73 KB NODE_PROFILING
ReactDOM-profiling.js -0.7% -0.2% 300.05 KB 297.95 KB 54.95 KB 54.82 KB FB_WWW_PROFILING
react-dom.profiling.min.js -0.4% -0.2% 100.04 KB 99.67 KB 32.29 KB 32.23 KB UMD_PROFILING

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js -0.3% -0.2% 464.94 KB 463.67 KB 103.19 KB 102.97 KB UMD_DEV
react-art.production.min.js -0.4% -0.2% 89.64 KB 89.29 KB 27.51 KB 27.47 KB UMD_PROD
react-art.development.js -0.3% -0.2% 396.71 KB 395.45 KB 86.07 KB 85.87 KB NODE_DEV
react-art.production.min.js -0.6% -0.3% 54.62 KB 54.26 KB 16.79 KB 16.73 KB NODE_PROD
ReactART-dev.js -0.3% -0.2% 401.09 KB 399.83 KB 84.53 KB 84.34 KB FB_WWW_DEV
ReactART-prod.js -1.2% -0.4% 168.79 KB 166.76 KB 28.25 KB 28.13 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.3% -0.2% 410.18 KB 408.91 KB 88.9 KB 88.71 KB UMD_DEV
react-test-renderer.production.min.js -0.6% -0.3% 56.08 KB 55.73 KB 17.17 KB 17.11 KB UMD_PROD
react-test-renderer.development.js -0.3% -0.2% 405.75 KB 404.48 KB 87.8 KB 87.6 KB NODE_DEV
react-test-renderer.production.min.js -0.6% -0.5% 55.79 KB 55.44 KB 16.97 KB 16.88 KB NODE_PROD
ReactTestRenderer-dev.js -0.3% -0.2% 410.47 KB 409.21 KB 86.61 KB 86.43 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.3% -0.2% 394.41 KB 393.14 KB 84.51 KB 84.32 KB NODE_DEV
react-reconciler.production.min.js -0.7% -0.3% 55.68 KB 55.31 KB 16.6 KB 16.54 KB NODE_PROD
react-reconciler-persistent.development.js -0.3% -0.2% 393.02 KB 391.75 KB 83.96 KB 83.76 KB NODE_DEV
react-reconciler-persistent.production.min.js -0.7% -0.3% 55.69 KB 55.32 KB 16.6 KB 16.54 KB NODE_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js -0.2% -0.1% 527.69 KB 526.43 KB 115.48 KB 115.31 KB RN_FB_DEV
ReactNativeRenderer-prod.js -0.9% -0.3% 223.6 KB 221.55 KB 38.56 KB 38.44 KB RN_FB_PROD
ReactNativeRenderer-dev.js -0.2% -0.2% 527.4 KB 526.14 KB 115.4 KB 115.23 KB RN_OSS_DEV
ReactNativeRenderer-prod.js -0.9% -0.3% 223.62 KB 221.56 KB 38.56 KB 38.44 KB RN_OSS_PROD
ReactFabric-dev.js -0.2% -0.2% 517.91 KB 516.65 KB 113.06 KB 112.88 KB RN_FB_DEV
ReactFabric-prod.js -0.9% -0.3% 218.18 KB 216.13 KB 37.29 KB 37.18 KB RN_FB_PROD
ReactFabric-dev.js -0.2% -0.2% 517.95 KB 516.69 KB 113.07 KB 112.89 KB RN_OSS_DEV
ReactFabric-prod.js -0.9% -0.3% 218.22 KB 216.16 KB 37.3 KB 37.19 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js -0.9% -0.3% 229.2 KB 227.15 KB 39.93 KB 39.79 KB RN_OSS_PROFILING
ReactFabric-profiling.js -0.9% -0.3% 222.94 KB 220.89 KB 38.59 KB 38.49 KB RN_OSS_PROFILING
ReactNativeRenderer-profiling.js -0.9% -0.3% 229.18 KB 227.13 KB 39.93 KB 39.79 KB RN_FB_PROFILING
ReactFabric-profiling.js -0.9% -0.3% 222.9 KB 220.85 KB 38.57 KB 38.47 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

@sebmarkbage sebmarkbage merged commit 7268d97 into facebook:master Oct 20, 2018
linjiajian999 pushed a commit to linjiajian999/react that referenced this pull request Oct 22, 2018
* Move memoizedProps to after beginWork remove memoizeProps helper

We always call this at the end. This is now enforced to line up since
we do the equality check in the beginning of beginWork. So we can't
have special cases.

* Inline the one caller of memoizeState
jetoneza pushed a commit to jetoneza/react that referenced this pull request Jan 23, 2019
* Move memoizedProps to after beginWork remove memoizeProps helper

We always call this at the end. This is now enforced to line up since
we do the equality check in the beginning of beginWork. So we can't
have special cases.

* Inline the one caller of memoizeState
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