Refactor task_groups & task_prefixes#4452
Merged
mrocklin merged 3 commits intodask:masterfrom Jan 23, 2021
Merged
Conversation
Moves `task_groups` and `task_prefixes` to `SchedulerState` where they are type annotated. Then uses them through `parent` within `Scheduler`. Allows Cython to recognize these are Python `dict`s and optimize calls and operations on them.
Instead of using `try...except...` to catch and handle `KeyError`s, just use `.get(...), which gets the key needed or returns `None`. This has less overhead. Also the following `None` check is a quick pointer comparison. Otherwise the code is unchanged.
Since it is used in the check as well, go ahead and assign it beforehand for simplicity.
Merged
This file contains hidden or 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
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.
Moves
task_groupsandtask_prefixestoSchedulerStatewhere they are type annotated. Then uses them throughparentwithinScheduler. Allows Cython to recognize these are Pythondicts and optimize calls and operations on them.Note: This is needed as part of optimizing transitions ( #4451 )