Skip to content

Conversation

@gaearon
Copy link
Collaborator

@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
Collaborator

@sebmarkbage sebmarkbage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gaearon
Copy link
Collaborator Author

gaearon commented Aug 7, 2018

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

@sophiebits
Copy link
Collaborator

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

@gaearon
Copy link
Collaborator Author

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

@gaearon
Copy link
Collaborator Author

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.

@gaearon gaearon merged commit 3b3b7fc into facebook:master Aug 7, 2018
@gaearon gaearon deleted the dont-search-past-sync branch August 7, 2018 01:07
@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

Development

Successfully merging this pull request may close these issues.

4 participants