Collapse the dispatch paths and split the large modules - #82
Merged
Conversation
One dispatcher for every context request in C, one NIF table entry list per area, one process body module per mode on the Erlang side, and a py facade that delegates streaming, venvs and shared dicts to their own modules. The thread functions and flags are named for what they are rather than for the worker mode they came from. No public API changes.
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.
The code that a reader had to hold in their head was bigger than the code that runs: nine copies of the enqueue-and-wait loop, a scheduler-side tail in every context NIF for a case that no longer exists, a 1 600-line context module that was both the API and the process, and a 1 700-line facade that carried the venv and streaming implementations inside it. This change leaves one dispatcher in C, one path per NIF, a NIF table assembled from one entry list per area,
py_contextas the API next topy_context_embeddedas the process, andpydelegating topy_stream,py_venvandpy_shared_dict. The thread functions and flags lose theworkerprefix the glossary asked to retire. Behaviour is unchanged except that creating a process-local env and applying imports in worker mode now run on the context thread as they already did in owngil mode.