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

Don't search beyond Sync roots for highest priority work #13335

Merged
merged 1 commit into from Aug 7, 2018

Conversation

@gaearon
Copy link
Member

@gaearon gaearon commented Aug 7, 2018

Fixes #13334 at a cost of one extra comparison per scheduled root.
Not directly observable — verified by manual testing with test cases from #13334 and #12700.

Unless I'm missing something it's useless to continue searching once we've found sync work since nothing else is going to win.

Copy link
Member

@sebmarkbage sebmarkbage left a comment

I'm convinced we should fix the general issue though since even just always picking the first one is still inline with semantics and even better for a single root.

Loading

@gaearon
Copy link
Member Author

@gaearon gaearon commented Aug 7, 2018

By "fix the general issue" you mean "stop prioritizing across roots" or...?

Loading

@sophiebits
Copy link
Collaborator

@sophiebits sophiebits commented Aug 7, 2018

Why is this n^2 in the first place though?

Loading

@gaearon
Copy link
Member Author

@gaearon gaearon commented Aug 7, 2018

We schedule N roots in a lifecycle.
Then we:

  1. Search for highest priority root
    • This is naïve and always walks all of them
  2. Render it
  3. If there are more scheduled roots, repeat

Loading

@gaearon
Copy link
Member Author

@gaearon gaearon commented Aug 7, 2018

Regardless of how we can optimize it, it seems like the current search procedure is useless after encountering a Sync root so I'll get this in.

Loading

@gaearon gaearon merged commit 3b3b7fc into facebook:master Aug 7, 2018
1 check passed
Loading
@gaearon gaearon deleted the dont-search-past-sync branch Aug 7, 2018
TejasQ pushed a commit to TejasQ/react that referenced this issue Aug 26, 2018
@gaearon gaearon mentioned this pull request Sep 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants