Repository navigation
perf(runner)!: persistent runner loop and latest-value limit mailbox - #128
Closed
greenhat616 wants to merge 3 commits into
Closed
greenhat616 wants to merge 3 commits into
greenhat616 wants to merge 3 commits into
Conversation
A pure move: `run` and `run_inner` go to `run_loop.rs`, buffering to `run_loop/stream.rs`, pushing to `run_loop/emit.rs`, draining to `run_loop/drain.rs`, `apply_control` and the control channel aliases to `control.rs`, and the tests to `tests.rs`. Function bodies are unchanged apart from visibility and formatting.
…ures Each event of the runner rebuilt its cancellation, control, idle and push futures inside a `select_biased!`. The runner is now a state machine (publishing `Started`, streaming, draining, publishing `Stopped`) whose sources live as long as the run; each phase polls them in its documented priority order. Pushes use `poll_ready` and `try_push` on a staged frame, so no future borrows the data sender. Measured against the plain move, interleaved: 13-24% less time per frame and 2.8 instead of 6.7 allocations per 32 KiB frame; setup, cancellation latency and eight concurrent runners are within noise.
The runner manager sent each limit through a bounded channel of 8 that a connecting runner does not read, so repeated splits could fill it. A manager only ever lowers a runner's limit, so it now sends limits through a lock-free single-slot mailbox: a newer limit replaces an unread one and the runner reads only the latest. A runner built with the public `TaskRunnerBuilder::control_signal` still applies every signal in order. BREAKING CHANGE: `TaskRunnerBuilder` fields are private; use its setters. `bolt_load::task::instance` no longer exports `RunnerManager`, `RunnerRegistration`, `ControlSender` and `ControlReceiver`, which only the concurrent task used.
Owner
Author
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.
Part 4/6. Stacked on part 3.
control.rsandrun_loop/{stream,emit,drain}.rs(pure move).select_biased!per event: -13..-24% time per frame, 2.8 instead of 6.7 allocations per 32 KiB frame (interleaved A/B).TaskRunnerBuilderfields are private;RunnerManager,RunnerRegistration,ControlSender,ControlReceiverare no longer exported.