-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Concurrent Renders #1165
Merged
Merged
Concurrent Renders #1165
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
rmorshea
force-pushed
the
concurrent-renders
branch
from
November 28, 2023 00:25
a6dd141
to
dd37697
Compare
Archmonger
reviewed
Nov 28, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a couple of side comments that aren't related to specific LOCs.
- Should we start considering allowing async components? I think they'd lead to some fairly clever design patterns. But, those are completely new design patterns that break ReactPy out of the "ReactJS mold".
- Should we use this PR to add Allow threading for sync
use_effect
calls #1136? - After merging, we will need a new issue for an deduplication algorithm.
- If a
parent
is already in the render queue, don't append a new child render. - If a
child
is already in the render queue, remove it from the queue.
- If a
- I set this PR to close Improve ReactPy Performance #557 since JSON patch is the only thing remaining. We've discussed that is a separate can of worms. Patch might not even be worth the computation time, or at the very least it should be toggleable.
- We will need to create an issue to remind ourselves to change this default from
False
toTrue
in v2. Or at least evaluate whether we should do that,
rmorshea
commented
Dec 1, 2023
I'll be able to finish this off over the weekend. |
Archmonger
reviewed
Dec 7, 2023
rmorshea
force-pushed
the
concurrent-renders
branch
from
December 8, 2023 06:23
af47c3a
to
6d969ec
Compare
There's still a couple of comments on my original review that need discussion. |
This was referenced Mar 8, 2024
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.
By submitting this pull request you agree that all contributions to this project are made under the MIT license.
Issues
Currently ReactPy renders components sequentially. This means that larger renders can block smaller updates from taking place which impacts responsiveness of the page. Sequential renders are also problematic for async effects since effects which are slow to start and stop can similarly impact the responsiveness of a page.
Solution
This change now allow renders to take place concurrently. To keep things simple, no effort is made to deduplicate renders. For example, if parent and child components are scheduled to render at the same time, both scheduled renders will take place even though a single render of the parent component would be sufficient to update the view.
Concurrent renders are achieved by "asyncifying" the internals of the
Layout
class. Additionally all scheduled renders immediately result in a "render task" being started. To avoid rendering the same component at the same time, we introduce a semaphore insideLifeCycleHook
s that must be acquired before a component is rendered.Note: this contains a subset of the changes originally created in #1093
Checklist
changelog.rst
has been updated with any significant changes.