Skip to content

Out-of-band www sync #18868

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

Closed
wants to merge 1 commit into from
Closed

Out-of-band www sync #18868

wants to merge 1 commit into from

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented May 8, 2020

Using this PR to run an out-of-band www sync. Not for merge.

Based off edf6eac, the currently synced revision.

Includes only #18864, which only affects the new fork. So it should be low risk.

* Detect and prevent render starvation, per lane

If an update is CPU-bound for longer than expected according to its
priority, we assume it's being starved by other work on the main thread.

To detect this, we keep track of the elapsed time using a fixed-size
array where each slot corresponds to a lane. What we actually store is
the event time when the lane first became CPU-bound.

Then, when receiving a new update or yielding to the main thread, we
check how long each lane has been pending. If the time exceeds a
threshold constant corresponding to its priority, we mark it as expired
to force it to synchronously finish.

We don't want to mistake time elapsed while an update is IO-bound
(waiting for data to resolve) for time when it is CPU-bound. So when a
lane suspends, we clear its associated event time from the array. When
it receives a signal to try again, either a ping or an update, we assign
a new event time to restart the clock.

* Store as expiration time, not start time

I originally stored the start time because I thought I could use this
in the future to also measure Suspense timeouts. (Event times are
currently stored on each update object for this purpose.) But that
won't work because in the case of expiration times, we reset the clock
whenever the update becomes IO-bound. So to replace the per-update
field, I'm going to have to track those on the room separately from
expiration times.
@acdlite acdlite changed the title Detect and prevent render starvation, per lane (#18864) Out-of-band www sync May 8, 2020
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels May 8, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented May 8, 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 d2b059b:

Sandbox Source
laughing-noether-qmw9n Configuration

@sizebot
Copy link

sizebot commented May 8, 2020

Details of bundled changes.

Comparing: edf6eac...d2b059b

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactDOM-profiling.js 0.0% 0.0% 445.39 KB 445.41 KB 78.63 KB 78.64 KB FB_WWW_PROFILING
react-dom-test-utils.production.min.js 0.0% 0.0% 13.05 KB 13.05 KB 4.79 KB 4.8 KB NODE_PROD
react-dom-server.browser.development.js 0.0% 0.0% 154.95 KB 154.95 KB 39.49 KB 39.49 KB UMD_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.5% 1.16 KB 1.16 KB 657 B 660 B NODE_PROD
react-dom-server.browser.production.min.js 0.0% 0.0% 22.97 KB 22.97 KB 8.53 KB 8.53 KB UMD_PROD
ReactDOMForked-dev.js +0.3% +0.3% 1.02 MB 1.02 MB 233.75 KB 234.46 KB FB_WWW_DEV
ReactDOMForked-prod.js 🔺+0.2% 🔺+0.3% 430.51 KB 431.58 KB 77.53 KB 77.75 KB FB_WWW_PROD
react-dom.development.js 0.0% 0.0% 911.34 KB 911.36 KB 200.43 KB 200.45 KB UMD_DEV
ReactDOMForked-profiling.js +0.2% +0.3% 440.27 KB 441.34 KB 79.18 KB 79.41 KB FB_WWW_PROFILING
react-dom.production.min.js 0.0% 0.0% 119.85 KB 119.87 KB 38.46 KB 38.47 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 123.62 KB 123.64 KB 39.63 KB 39.64 KB UMD_PROFILING
ReactDOMTesting-dev.js 0.0% 0.0% 956.91 KB 956.94 KB 213.7 KB 213.72 KB FB_WWW_DEV
react-dom.development.js 0.0% 0.0% 867.47 KB 867.5 KB 197.9 KB 197.92 KB NODE_DEV
ReactDOMTesting-prod.js 0.0% 0.0% 404.85 KB 404.87 KB 74.71 KB 74.71 KB FB_WWW_PROD
react-dom-server.node.development.js 0.0% 0.0% 147.01 KB 147.01 KB 38.97 KB 38.97 KB NODE_DEV
react-dom.production.min.js 0.0% 0.0% 119.97 KB 120 KB 37.59 KB 37.59 KB NODE_PROD
react-dom-test-utils.development.js 0.0% 0.0% 75.28 KB 75.28 KB 20.18 KB 20.18 KB UMD_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 23.27 KB 23.27 KB 8.67 KB 8.67 KB NODE_PROD
react-dom.profiling.min.js 0.0% 0.0% 123.86 KB 123.89 KB 38.8 KB 38.81 KB NODE_PROFILING
react-dom-test-utils.production.min.js 0.0% 0.0% 13.17 KB 13.17 KB 4.89 KB 4.89 KB UMD_PROD
ReactDOM-dev.js 0.0% 0.0% 1.02 MB 1.02 MB 232.5 KB 232.51 KB FB_WWW_DEV
ReactDOM-prod.js 0.0% 0.0% 434.43 KB 434.45 KB 76.79 KB 76.8 KB FB_WWW_PROD
react-dom-test-utils.development.js 0.0% 0.0% 70.11 KB 70.11 KB 19.67 KB 19.68 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% +0.2% 5.6 KB 5.6 KB 1.85 KB 1.86 KB NODE_DEV
react-dom-server.browser.development.js 0.0% 0.0% 145.79 KB 145.79 KB 38.72 KB 38.72 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 22.87 KB 22.87 KB 8.51 KB 8.51 KB NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.3% 5.35 KB 5.35 KB 1.79 KB 1.8 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.4% 1.19 KB 1.19 KB 695 B 698 B UMD_PROD
ReactDOMServer-dev.js 0.0% 0.0% 163.94 KB 163.94 KB 41.78 KB 41.79 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% 0.0% 52.9 KB 52.9 KB 12.74 KB 12.74 KB FB_WWW_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.2% 4.85 KB 4.85 KB 1.69 KB 1.7 KB NODE_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.3% 1 KB 1 KB 607 B 609 B NODE_PROD

ReactDOM: size: 0.0%, gzip: 0.0%

Size changes (stable)

Generated by 🚫 dangerJS against d2b059b

@sizebot
Copy link

sizebot commented May 8, 2020

Details of bundled changes.

Comparing: edf6eac...d2b059b

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-test-utils.development.js 0.0% 0.0% 75.29 KB 75.29 KB 20.19 KB 20.19 KB UMD_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.3% 5.36 KB 5.36 KB 1.8 KB 1.81 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% 🔺+0.1% 13.18 KB 13.18 KB 4.9 KB 4.9 KB UMD_PROD
ReactDOMTesting-dev.js 0.0% 0.0% 931.12 KB 931.14 KB 208.18 KB 208.2 KB FB_WWW_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.4% 1.2 KB 1.2 KB 703 B 706 B UMD_PROD
react-dom.development.js 0.0% 0.0% 945.21 KB 945.23 KB 206.9 KB 206.92 KB UMD_DEV
react-dom-server.browser.development.js 0.0% 0.0% 162.26 KB 162.26 KB 41.28 KB 41.29 KB UMD_DEV
react-dom.production.min.js 0.0% 0.0% 124.64 KB 124.66 KB 39.91 KB 39.91 KB UMD_PROD
ReactDOMForked-dev.js +0.3% +0.3% 1015.41 KB 1018.56 KB 228.04 KB 228.76 KB FB_WWW_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 23.43 KB 23.43 KB 8.61 KB 8.61 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 128.52 KB 128.54 KB 41.07 KB 41.08 KB UMD_PROFILING
ReactDOMForked-prod.js 🔺+0.3% 🔺+0.3% 418.93 KB 420 KB 75.47 KB 75.72 KB FB_WWW_PROD
react-dom.development.js 0.0% 0.0% 899.9 KB 899.92 KB 204.35 KB 204.36 KB NODE_DEV
ReactDOMForked-profiling.js +0.2% +0.3% 428.63 KB 429.7 KB 77.13 KB 77.36 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 152.74 KB 152.74 KB 40.51 KB 40.52 KB NODE_DEV
react-dom.production.min.js 0.0% 0.0% 124.82 KB 124.84 KB 39.01 KB 39.01 KB NODE_PROD
react-dom-server.browser.production.min.js 0.0% 0.0% 23.32 KB 23.32 KB 8.6 KB 8.6 KB NODE_PROD
react-dom.profiling.min.js 0.0% 0.0% 128.86 KB 128.88 KB 40.31 KB 40.31 KB NODE_PROFILING
ReactDOM-dev.js 0.0% 0.0% 1018.04 KB 1018.06 KB 226.89 KB 226.9 KB FB_WWW_DEV
ReactDOMServer-dev.js 0.0% 0.0% 160.45 KB 160.45 KB 40.87 KB 40.88 KB FB_WWW_DEV
ReactDOM-prod.js 0.0% 0.0% 422.96 KB 422.99 KB 74.78 KB 74.79 KB FB_WWW_PROD
ReactDOMServer-prod.js 0.0% 0.0% 52.01 KB 52.01 KB 12.55 KB 12.55 KB FB_WWW_PROD
ReactDOM-profiling.js 0.0% 0.0% 433.86 KB 433.89 KB 76.62 KB 76.63 KB FB_WWW_PROFILING
react-dom-unstable-fizz.node.development.js 0.0% +0.2% 5.61 KB 5.61 KB 1.86 KB 1.87 KB NODE_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.5% 1.17 KB 1.17 KB 665 B 668 B NODE_PROD
ReactDOMTesting-prod.js 0.0% 0.0% 392.99 KB 393.01 KB 72.69 KB 72.69 KB FB_WWW_PROD
react-dom-test-utils.development.js 0.0% 0.0% 70.12 KB 70.12 KB 19.68 KB 19.68 KB NODE_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.2% 4.87 KB 4.87 KB 1.7 KB 1.7 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 13.06 KB 13.06 KB 4.8 KB 4.81 KB NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.3% 1.02 KB 1.02 KB 615 B 617 B NODE_PROD
react-dom-server.node.development.js 0.0% 0.0% 153.96 KB 153.96 KB 40.77 KB 40.77 KB NODE_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 23.73 KB 23.73 KB 8.75 KB 8.75 KB NODE_PROD

ReactDOM: size: 0.0%, gzip: 🔺+0.1%

Size changes (experimental)

Generated by 🚫 dangerJS against d2b059b

@acdlite acdlite closed this May 8, 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.

3 participants