Skip to content

Collapse the dispatch paths and split the large modules - #82

Merged
benoitc merged 1 commit into
mainfrom
collapse-dispatch
Aug 29, 2026
Merged

Collapse the dispatch paths and split the large modules#82
benoitc merged 1 commit into
mainfrom
collapse-dispatch

Conversation

@benoitc

@benoitc benoitc commented Aug 29, 2026

Copy link
Copy Markdown
Owner

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_context as the API next to py_context_embedded as the process, and py delegating to py_stream, py_venv and py_shared_dict. The thread functions and flags lose the worker prefix 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.

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.
@benoitc
benoitc merged commit e44a0aa into main Aug 29, 2026
20 checks passed
@benoitc
benoitc deleted the collapse-dispatch branch August 29, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant