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

Always batch updates of like priority within the same event #13071

Merged
merged 1 commit into from Jun 19, 2018

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Jun 18, 2018

Expiration times are computed by adding to the current time (the start time). However, if two updates are scheduled within the same event, we should treat their start times as simultaneous, even if the actual clock time has advanced between the first and second call.

In other words, because expiration times determine how updates are batched, we want all updates of like priority that occur within the same event to receive the same expiration time. Otherwise we get tearing.

We keep track of two separate times: the current "renderer" time and the current "scheduler" time. The renderer time can be updated whenever; it only exists to minimize the calls to performance.now.

But the scheduler time can only be updated if there's no pending work, or if we know for certain that we're not in the middle of an event.

Expiration times are computed by adding to the current time (the start
time). However, if two updates are scheduled within the same event, we
should treat their start times as simultaneous, even if the actual clock
time has advanced between the first and second call.

In other words, because expiration times determine how updates are
batched, we want all updates of like priority that occur within the same
event to receive the same expiration time. Otherwise we get tearing.

We keep track of two separate times: the current "renderer" time and the
current "scheduler" time. The renderer time can be updated whenever; it
only exists to minimize the calls performance.now.

But the scheduler time can only be updated if there's no pending work,
or if we know for certain that we're not in the middle of an event.
@pull-bot
Copy link

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

Details of bundled changes.

Comparing: ae14317...bd000d9

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js +0.3% +0.3% 624.18 KB 625.96 KB 145.76 KB 146.25 KB UMD_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.2% 95.14 KB 95.23 KB 30.76 KB 30.82 KB UMD_PROD
react-dom.development.js +0.3% +0.3% 616.35 KB 618.13 KB 143.57 KB 144.07 KB NODE_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.1% 94.87 KB 94.96 KB 30.1 KB 30.14 KB NODE_PROD
ReactDOM-dev.js +0.3% +0.3% 626.41 KB 628.15 KB 142.99 KB 143.46 KB FB_WWW_DEV
ReactDOM-prod.js 🔺+0.1% 🔺+0.1% 271.66 KB 272.06 KB 51.2 KB 51.25 KB FB_WWW_PROD
react-dom.profiling.min.js +0.1% +0.1% 95.78 KB 95.87 KB 30.4 KB 30.43 KB NODE_PROFILING

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js +0.4% +0.6% 408.3 KB 410.08 KB 91.13 KB 91.63 KB UMD_DEV
react-art.production.min.js 🔺+0.1% 🔺+0.1% 82.35 KB 82.43 KB 25.38 KB 25.42 KB UMD_PROD
react-art.development.js +0.5% +0.7% 336.53 KB 338.31 KB 73.14 KB 73.64 KB NODE_DEV
react-art.production.min.js 🔺+0.2% 🔺+0.2% 47.07 KB 47.16 KB 14.61 KB 14.65 KB NODE_PROD
ReactART-dev.js +0.5% +0.7% 329.25 KB 331 KB 69.06 KB 69.56 KB FB_WWW_DEV
ReactART-prod.js 🔺+0.3% 🔺+0.2% 142.67 KB 143.04 KB 24.53 KB 24.58 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.5% +0.7% 342.57 KB 344.35 KB 74.17 KB 74.66 KB UMD_DEV
react-test-renderer.production.min.js 🔺+0.2% 🔺+0.2% 47.25 KB 47.33 KB 14.52 KB 14.55 KB UMD_PROD
react-test-renderer.development.js +0.5% +0.7% 334.93 KB 336.71 KB 72.09 KB 72.59 KB NODE_DEV
react-test-renderer.production.min.js 🔺+0.2% 🔺+0.2% 46.69 KB 46.77 KB 14.2 KB 14.23 KB NODE_PROD
ReactTestRenderer-dev.js +0.5% +0.7% 340.77 KB 342.52 KB 71.7 KB 72.23 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.5% +0.7% 327.14 KB 328.91 KB 69.64 KB 70.14 KB NODE_DEV
react-reconciler.production.min.js 🔺+0.2% 🔺+0.3% 46.8 KB 46.89 KB 13.98 KB 14.03 KB NODE_PROD
react-reconciler-persistent.development.js +0.5% +0.7% 325.76 KB 327.53 KB 69.06 KB 69.56 KB NODE_DEV
react-reconciler-persistent.production.min.js 🔺+0.2% 🔺+0.3% 46.81 KB 46.9 KB 13.99 KB 14.03 KB NODE_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js +0.4% +0.5% 460.56 KB 462.3 KB 100.99 KB 101.48 KB RN_FB_DEV
ReactNativeRenderer-prod.js 🔺+0.2% 🔺+0.1% 206.16 KB 206.54 KB 36.17 KB 36.21 KB RN_FB_PROD
ReactNativeRenderer-dev.js +0.4% +0.5% 460.27 KB 462.01 KB 100.93 KB 101.42 KB RN_OSS_DEV
ReactNativeRenderer-prod.js 🔺+0.2% 🔺+0.2% 198.72 KB 199.1 KB 34.72 KB 34.78 KB RN_OSS_PROD
ReactFabric-dev.js +0.4% +0.5% 450.87 KB 452.62 KB 98.62 KB 99.1 KB RN_FB_DEV
ReactFabric-prod.js 🔺+0.2% 🔺+0.2% 191 KB 191.38 KB 33.33 KB 33.4 KB RN_FB_PROD
ReactFabric-dev.js +0.4% +0.5% 450.91 KB 452.65 KB 98.63 KB 99.12 KB RN_OSS_DEV
ReactFabric-prod.js 🔺+0.2% 🔺+0.2% 191.03 KB 191.42 KB 33.35 KB 33.41 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js +0.2% +0.2% 201.25 KB 201.64 KB 35.27 KB 35.33 KB RN_OSS_PROFILING
ReactFabric-profiling.js +0.2% +0.2% 193.25 KB 193.64 KB 33.82 KB 33.88 KB RN_OSS_PROFILING

Generated by 🚫 dangerJS

@NE-SmallTown
Copy link
Contributor

What does 'same event' mean? Same event loop or something else?

@cyan33
Copy link
Contributor

cyan33 commented Jun 21, 2018

@NE-SmallTown Same event handler like onClick

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.

None yet

5 participants