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

Track event times per lane on the root #19387

Merged
merged 2 commits into from
Jul 17, 2020

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Jul 16, 2020

Previous strategy was to store the event time on the update object and accumulate the most recent one during the render phase.

Among other advantages, by tracking them on the root, we can read the event time before the render phase has finished.

I haven't removed the eventTime field from the update object yet, because it's still used to compute the timeout. Tracking the timeout on the root is my next step.

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

codesandbox-ci bot commented Jul 16, 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 6a2703c:

Sandbox Source
React Configuration

@sizebot
Copy link

sizebot commented Jul 16, 2020

Details of bundled changes.

Comparing: faa697f...6a2703c

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js +0.1% +0.1% 918.13 KB 918.77 KB 209.03 KB 209.21 KB NODE_DEV
ReactDOMForked-prod.js 🔺+0.3% 🔺+0.2% 394.58 KB 395.83 KB 73.54 KB 73.7 KB FB_WWW_PROD
react-dom-server.node.development.js 0.0% 0.0% 138.84 KB 138.84 KB 36.7 KB 36.7 KB NODE_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.2% 123.79 KB 123.97 KB 39.67 KB 39.73 KB NODE_PROD
ReactDOMForked-profiling.js +0.3% +0.2% 409.55 KB 410.84 KB 76.22 KB 76.38 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 145.03 KB 145.03 KB 36.89 KB 36.89 KB UMD_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 20.72 KB 20.72 KB 7.67 KB 7.68 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.1% +0.1% 953.78 KB 954.39 KB 214.18 KB 214.33 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.4% 🔺+0.3% 399.31 KB 400.81 KB 75.55 KB 75.74 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.1% 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 666 B 668 B NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.1% 1.2 KB 1.2 KB 705 B 706 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.1% +0.1% 964.5 KB 965.19 KB 211.59 KB 211.78 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.2% 1.01 KB 1.01 KB 616 B 617 B NODE_PROD
react-dom.production.min.js 🔺+0.1% 0.0% 123.6 KB 123.78 KB 40.49 KB 40.51 KB UMD_PROD
react-dom.profiling.min.js +0.1% +0.2% 128.79 KB 128.98 KB 42.07 KB 42.13 KB UMD_PROFILING
ReactDOMForked-dev.js +0.1% 0.0% 991.51 KB 992.11 KB 221.09 KB 221.19 KB FB_WWW_DEV
react-dom.profiling.min.js +0.1% +0.2% 129.16 KB 129.34 KB 41.34 KB 41.42 KB NODE_PROFILING
react-dom-server.browser.production.min.js 0.0% 0.0% 20.38 KB 20.38 KB 7.54 KB 7.55 KB UMD_PROD
ReactDOM-dev.js +0.1% +0.1% 988.2 KB 988.8 KB 220.8 KB 220.93 KB FB_WWW_DEV
ReactDOM-prod.js 🔺+0.1% 🔺+0.2% 393.82 KB 394.39 KB 73.31 KB 73.43 KB FB_WWW_PROD
react-dom-server.browser.development.js 0.0% 0.0% 137.57 KB 137.57 KB 36.45 KB 36.45 KB NODE_DEV
ReactDOM-profiling.js +0.1% +0.2% 408.25 KB 408.79 KB 75.94 KB 76.06 KB FB_WWW_PROFILING
ReactDOMServer-dev.js 0.0% 0.0% 143.33 KB 143.33 KB 36.43 KB 36.43 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% 0.0% 55.53 KB 55.53 KB 15.37 KB 15.37 KB UMD_DEV

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactART-prod.js 🔺+0.2% 🔺+0.3% 239.91 KB 240.47 KB 42.46 KB 42.58 KB FB_WWW_PROD
react-art.development.js +0.1% +0.1% 694.07 KB 694.76 KB 146.92 KB 147.08 KB UMD_DEV
react-art.production.min.js 🔺+0.2% 🔺+0.1% 112.61 KB 112.78 KB 34.87 KB 34.9 KB UMD_PROD
react-art.development.js +0.1% +0.1% 595.15 KB 595.79 KB 129.08 KB 129.24 KB NODE_DEV
react-art.production.min.js 🔺+0.2% 🔺+0.3% 77.5 KB 77.68 KB 23.95 KB 24.02 KB NODE_PROD
ReactART-dev.js +0.1% +0.1% 627.16 KB 627.76 KB 133.25 KB 133.38 KB FB_WWW_DEV

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js +0.1% +0.1% 685.13 KB 685.74 KB 148.24 KB 148.37 KB RN_FB_DEV
ReactFabric-dev.js +0.1% +0.1% 665.85 KB 666.46 KB 143.56 KB 143.71 KB RN_FB_DEV
ReactNativeRenderer-dev.js +0.1% +0.1% 679.74 KB 680.34 KB 147.39 KB 147.52 KB RN_OSS_DEV
ReactFabric-prod.js 🔺+0.2% 🔺+0.3% 265.33 KB 265.95 KB 47 KB 47.15 KB RN_FB_PROD
ReactNativeRenderer-prod.js 🔺+0.2% 🔺+0.3% 271.65 KB 272.15 KB 48.31 KB 48.44 KB RN_OSS_PROD
ReactFabric-profiling.js +0.2% +0.3% 276.83 KB 277.31 KB 49.2 KB 49.33 KB RN_FB_PROFILING
ReactNativeRenderer-profiling.js +0.2% +0.2% 283.13 KB 283.68 KB 50.49 KB 50.61 KB RN_OSS_PROFILING
ReactNativeRenderer-prod.js 🔺+0.2% 🔺+0.3% 271.61 KB 272.11 KB 48.29 KB 48.42 KB RN_FB_PROD
ReactNativeRenderer-profiling.js +0.2% +0.2% 283.08 KB 283.64 KB 50.47 KB 50.59 KB RN_FB_PROFILING
ReactFabric-dev.js +0.1% +0.1% 660.45 KB 661.06 KB 142.71 KB 142.86 KB RN_OSS_DEV
ReactFabric-prod.js 🔺+0.2% 🔺+0.3% 265.37 KB 265.98 KB 47.02 KB 47.16 KB RN_OSS_PROD
ReactFabric-profiling.js +0.2% +0.3% 276.87 KB 277.35 KB 49.22 KB 49.35 KB RN_OSS_PROFILING

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.1% +0.1% 654.75 KB 655.4 KB 139.42 KB 139.57 KB NODE_DEV
react-reconciler-reflection.development.js 0.0% 0.0% 16.71 KB 16.71 KB 4.98 KB 4.98 KB NODE_DEV
react-reconciler.production.min.js 🔺+0.2% 🔺+0.2% 87.6 KB 87.77 KB 26.85 KB 26.91 KB NODE_PROD
react-reconciler-reflection.production.min.js 0.0% 🔺+0.1% 2.81 KB 2.81 KB 1.16 KB 1.16 KB NODE_PROD

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.1% +0.1% 605.36 KB 606.05 KB 127.23 KB 127.39 KB UMD_DEV
react-test-renderer.production.min.js 🔺+0.2% 🔺+0.1% 76.78 KB 76.96 KB 24.03 KB 24.06 KB UMD_PROD
react-test-renderer.development.js +0.1% +0.1% 576.74 KB 577.39 KB 125.78 KB 125.94 KB NODE_DEV
react-test-renderer.production.min.js 🔺+0.2% 🔺+0.3% 76.59 KB 76.78 KB 23.72 KB 23.78 KB NODE_PROD
ReactTestRenderer-dev.js +0.1% +0.1% 599.68 KB 600.29 KB 128.55 KB 128.68 KB FB_WWW_DEV
ReactTestRenderer-dev.js +0.1% +0.1% 593.03 KB 593.64 KB 128.36 KB 128.5 KB RN_FB_DEV

ReactDOM: size: 0.0%, gzip: 0.0%

Size changes (experimental)

Generated by 🚫 dangerJS against 6a2703c

@sizebot
Copy link

sizebot commented Jul 16, 2020

Details of bundled changes.

Comparing: faa697f...6a2703c

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js +0.1% +0.1% 881.01 KB 881.66 KB 202.26 KB 202.42 KB NODE_DEV
ReactDOMForked-prod.js 🔺+0.3% 🔺+0.2% 405.71 KB 406.96 KB 75.17 KB 75.33 KB FB_WWW_PROD
react-dom-server.node.development.js 0.0% 0.0% 137.33 KB 137.33 KB 36.49 KB 36.49 KB NODE_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.2% 119.01 KB 119.18 KB 38.26 KB 38.32 KB NODE_PROD
ReactDOMForked-profiling.js +0.3% +0.2% 420.75 KB 422.04 KB 77.84 KB 77.99 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 143.44 KB 143.44 KB 36.7 KB 36.7 KB UMD_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 20.26 KB 20.26 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.1% +0.1% 981.86 KB 982.47 KB 219.72 KB 219.84 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% 0.0% 51.13 KB 51.13 KB 14.89 KB 14.89 KB NODE_DEV
ReactDOMTesting-prod.js 🔺+0.4% 🔺+0.2% 412.63 KB 414.13 KB 77.54 KB 77.71 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.1% +0.1% 925.59 KB 926.28 KB 204.74 KB 204.92 KB UMD_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.1% 118.88 KB 119.06 KB 39.02 KB 39.06 KB UMD_PROD
react-dom.profiling.min.js +0.1% +0.2% 122.8 KB 122.97 KB 40.17 KB 40.23 KB UMD_PROFILING
ReactDOMForked-dev.js +0.1% +0.1% 1017.05 KB 1017.65 KB 225.97 KB 226.09 KB FB_WWW_DEV
react-dom.profiling.min.js +0.1% +0.2% 123.06 KB 123.24 KB 39.47 KB 39.54 KB NODE_PROFILING
ReactDOM-dev.js +0.1% +0.1% 1013.74 KB 1014.34 KB 225.66 KB 225.78 KB FB_WWW_DEV
ReactDOM-prod.js 🔺+0.1% 🔺+0.1% 404.95 KB 405.52 KB 74.91 KB 75.02 KB FB_WWW_PROD
react-dom-server.browser.development.js 0.0% 0.0% 136.06 KB 136.06 KB 36.24 KB 36.24 KB NODE_DEV
ReactDOM-profiling.js +0.1% +0.1% 419.45 KB 419.98 KB 77.57 KB 77.68 KB FB_WWW_PROFILING
ReactDOMServer-dev.js 0.0% 0.0% 147.37 KB 147.37 KB 37.43 KB 37.43 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% 0.0% 47.54 KB 47.54 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

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactART-prod.js 🔺+0.2% 🔺+0.3% 247.06 KB 247.62 KB 43.73 KB 43.85 KB FB_WWW_PROD
react-art.development.js +0.1% +0.1% 666.81 KB 667.5 KB 141.91 KB 142.06 KB UMD_DEV
react-art.production.min.js 🔺+0.2% 🔺+0.1% 109.63 KB 109.81 KB 33.97 KB 34 KB UMD_PROD
react-art.development.js +0.1% +0.1% 569.16 KB 569.81 KB 124.15 KB 124.3 KB NODE_DEV
react-art.production.min.js 🔺+0.2% 🔺+0.3% 74.59 KB 74.77 KB 23.07 KB 23.15 KB NODE_PROD
ReactART-dev.js +0.1% +0.1% 637.17 KB 637.78 KB 135.29 KB 135.41 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.1% +0.1% 626.4 KB 627.05 KB 134.01 KB 134.16 KB NODE_DEV
react-reconciler-reflection.development.js 0.0% 0.0% 16.69 KB 16.69 KB 4.98 KB 4.98 KB NODE_DEV
react-reconciler.production.min.js 🔺+0.2% 🔺+0.3% 84.24 KB 84.42 KB 25.91 KB 25.98 KB NODE_PROD
react-reconciler-reflection.production.min.js 0.0% 🔺+0.1% 2.8 KB 2.8 KB 1.15 KB 1.15 KB NODE_PROD

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.1% +0.1% 605.34 KB 606.03 KB 127.22 KB 127.37 KB UMD_DEV
react-test-renderer.production.min.js 🔺+0.2% 🔺+0.1% 76.75 KB 76.93 KB 24.01 KB 24.04 KB UMD_PROD
react-test-renderer.development.js +0.1% +0.1% 576.72 KB 577.37 KB 125.76 KB 125.93 KB NODE_DEV
react-test-renderer.production.min.js 🔺+0.2% 🔺+0.3% 76.57 KB 76.75 KB 23.71 KB 23.77 KB NODE_PROD
ReactTestRenderer-dev.js +0.1% +0.1% 599.67 KB 600.27 KB 128.55 KB 128.68 KB FB_WWW_DEV
ReactTestRenderer-dev.js +0.1% +0.1% 593.02 KB 593.62 KB 128.35 KB 128.5 KB RN_FB_DEV

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js +0.1% +0.1% 679.72 KB 680.33 KB 147.38 KB 147.52 KB RN_OSS_DEV
ReactNativeRenderer-prod.js 🔺+0.2% 🔺+0.3% 271.64 KB 272.14 KB 48.3 KB 48.43 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js +0.2% +0.2% 283.11 KB 283.67 KB 50.48 KB 50.6 KB RN_OSS_PROFILING
ReactFabric-dev.js +0.1% +0.1% 660.44 KB 661.04 KB 142.7 KB 142.85 KB RN_OSS_DEV
ReactFabric-prod.js 🔺+0.2% 🔺+0.3% 265.35 KB 265.97 KB 47.01 KB 47.15 KB RN_OSS_PROD
ReactFabric-profiling.js +0.2% +0.3% 276.86 KB 277.34 KB 49.21 KB 49.34 KB RN_OSS_PROFILING

ReactDOM: size: 0.0%, gzip: 0.0%

Size changes (stable)

Generated by 🚫 dangerJS against 6a2703c

@acdlite
Copy link
Collaborator Author

acdlite commented Jul 17, 2020

Old fork tests are failing because I forgot to sync changes to ReactFiberRoot.old. Will fix in a bit.

@acdlite acdlite force-pushed the track-event-time-on-root branch 2 times, most recently from a478883 to 1327c6b Compare July 17, 2020 05:06
let lanes = noLongerPendingLanes;
while (lanes > 0) {
const index = pickArbitraryLaneIndex(lanes);
const lane = 1 << index;

// Clear the expiration time
entanglements[index] = NoLanes;
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 line was an oversight from when I added the entanglement feature. It's theoretically observable but if I write a test it'll be super convoluted, since we currently only use entanglement for useMutableSource, and only in a particular de-opt case.

Some minor rearranging so that eventTime gets threaded through. No
change in behavior.
Previous strategy was to store the event time on the update object
and accumulate the most recent one during the render phase.

Among other advantages, by tracking them on the root, we can read the
event time before the render phase has finished.

I haven't removed the `eventTime` field from the update object yet,
because it's still used to compute the timeout. Tracking the timeout
on the root is my next step.
@acdlite acdlite merged commit b23ea02 into facebook:master Jul 17, 2020
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.

4 participants