-
Notifications
You must be signed in to change notification settings - Fork 46.4k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
ReactDOM: size: 🔺+0.1%, gzip: 🔺+0.2% Details of bundled changes.Comparing: ae14317...bd000d9 react-dom
react-art
react-test-renderer
react-reconciler
react-native-renderer
Generated by 🚫 dangerJS |
What does 'same event' mean? Same event loop or something else? |
@NE-SmallTown Same event handler like |
This pull request was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.