-
-
Notifications
You must be signed in to change notification settings - Fork 8.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
refactor(scheduler): remove redundant sorting #11646
Merged
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
# Conflicts: # packages/runtime-core/src/scheduler.ts
Size ReportBundles
Usages
|
commit: @vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
|
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
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.
Note: This PR currently contains all the changes from #7746. I think that PR should be merged first. This PR is much simpler than it looks, but I needed the code from that PR to avoid breaking the tests.
To understand the refactoring I've done here, see commit fed5518.
Currently, we sort scheduler jobs twice in the main scheduler queue:
queueJob
/findInsertionIndex
we calculate where to insert new jobs, ensuring the queue is correctly sorted.flushJobs
we sort the queue again.This second sort shouldn't be needed, as the jobs should already be sorted. Its extra code and extra work. It can also lead to inconsistencies and bugs when the two sorts don't perfectly align.
This PR removes that second sort.
This caused a few test failures. Those failures had two underlying causes:
findInsertionIndex
. The value ofstart
needs to be0
whenisFlushing
isfalse
, but it was being set to1
instead. This bug didn't impact users because the sort influshJobs
was correcting the order. Now the second sort is removed it needs to be handled directly infindInsertionIndex
.With those problems addressed, the existing tests all pass.