Repository navigation
perf(shell): pool private channel instances across session commands - #947
Draft
Haoming9527 wants to merge 1 commit into
Draft
Haoming9527 wants to merge 1 commit into
Haoming9527 wants to merge 1 commit into
Conversation
13 tasks
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.
Refs #872. Stacked on #946 (
work/872-presentation-cache).What was wrong
Every persistent-shell command recreated three private channels: twelve named-pipe instances and twelve reader threads. The channel-wakeup changes removed the long drain delay, but repeated allocation and teardown still contributed to roughly 9 ms command latency.
The change
Create three bounded pools per session and reuse their private pipe instances and reader threads. Each command gets fresh captures, authenticated prefixes, seal/cancel state and spill ownership. Every connect must be armed before the endpoint is published. Output still drains to authenticated natural EOF and checked spill settlement; operations and task captures retire before the generation completion event. Retiring channels clear their cancellation handles before returning the lease, and old views remain separate. Timeout or panic poisons reuse permanently.
The driver uses these pools for stdout, stderr and receipts. Receipt parsing, Job identity checks, unregistered-output detection, surviving-descendant reset and independent session cancellation remain unchanged. The pool retains twelve readers per active session and still reconnects MSYS endpoints per command; it is not a persistent framed-output protocol.
Includes bilingual docs/changelog, raw benchmark reports, owned-child regressions and a real-resident endpoint reuse regression. No dependency, runtime pin, release or model-facing schema change.
Validation
npm run buildand release driver/worker builds: passed.cargo clippy -p ops-process --all-targets --locked --manifest-path native/Cargo.toml -- -D warnings: passed.Same comparison harness, Windows host, stock Niubash and release profile; 300 empty samples after 30 warmups, 100 printf samples, original 256 MiB bulk arm; before then after:
Raw reports and binary hashes are in
bench/probes/872/channel-pool-evidence. The 1 ms / 3 ms acceptance target remains unmet. The 106-operation scenario, cold startup and full host overhead remain unmeasured; no WSL superiority or full #872 acceptance is claimed.Pull-request-triggered CI: https://github.com/T-Auto/dsh-ops/actions/runs/43614804031 (all 10 jobs passed, including CI required).
Environment
Windows x64 10.0.26300, Ryzen 7 6800HS, Node 26.12.1, Rust 1.97.1 release, locked dependencies and an isolated Cargo target. Base #946 at
54b681f6e360571458d7cfb6c584106ae70ecc06has all 10 CI jobs green: https://github.com/T-Auto/dsh-ops/actions/runs/43613610235. No merge, tag or release.