-
-
Notifications
You must be signed in to change notification settings - Fork 727
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Annotate `keys` & `new` * Combine `recommendations` annotation with others * Annotate `dependents` & `dependencies` * Annotate `start` & `finish` * Create empty `dict` for `recommendations` once Instead of letting Cython generate empty `dict`s for each of these cases, just create an empty `dict` once and assign it to `recommendations`. That way we can just `return` it simply and avoid the C boilerplate that would otherwise be needed. * Use `.get(...)` to retrieve `TaskState` * Assign `start, finish` to a variable * Just use `.get(...)` to retrieve transition func Avoids checking for the presence of the key and then retrieving the function corresponding the key by simply trying to get the function in the first place or `None` if it is absent. As it is pretty quick to check if something is `None` both in Python and Cython, this should speed up the check and function retrieval time. * Annotate `a` & `b` * Use `.get(...)` to get `key` from `a` Avoids looking up `key` twice. Once to see if it is there and a second time to grab it. This way we just grab the value corresponding to `key` or `None` if it is missing. The following `None` check is quite fast in both Python and Cython. * Just `update` `recommendations` with `a` & `b` * Drop unneeded `KeyError` handling Neither of these statements should raise a `KeyError`. So just drop this `try...except...`. * Annotate `finish2` * Replace generator with simple `for`-loop This avoids building a `list`, which makes it easier for Cython to optimize. * Bind `tuple` results to typed variable This should simplify the C code generated by Cython to unpack the `tuple` as it no longer needs to check if it is a `list` or some other sequence that needs to be unpacked and can simply use the `tuple` unpacking logic. * Collect `list` of messages for clients and workers * Extend `BatchedSend`'s `send` to take many msgs * Add `send_all` method and use in `transition` This allows us to batch all worker and client sends into a single function. * Deliver all messages to batched send * Refactor out private `_transition` function * Send all messages after processing all transitions * `declare` `ALL_TASK_STATES` a `set`
- Loading branch information
Showing
2 changed files
with
174 additions
and
57 deletions.
There are no files selected for viewing
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
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