perf(terminal): drop redundant per-frame clone in pty sink hot path; cfg(unix) test hygiene (e2rj) - #642
Merged
Merged
Conversation
Validated 7 assumptions (ledger in .the-usual-logs): baselines green, local toolchain 1.96.0 == CI pin, seq contract verified (seq_start == seq_end, contiguous +1). FALSIFIED: the echo sink test emits exactly one frame, so the planned seq-order assertion was vacuous there. Plan now adds a cfg(unix) multi-frame (~41 KB) seq-order test as the real ordering net, updates expected test counts (4 -> 5 after Task 1), and records verified baselines for the implementer.
The emit closure cloned every ServerMessage for the sink and then dropped the originals — one redundant deep copy of each output frame's data String per frame, in the hottest path in the terminal server. Sink and capture destinations are mutually exclusive (capture is gated on sink absence), so restructure as if/else and iterate by value; delete the now-redundant capture_enabled flag. Strengthens the sink gate test with a seq-order assertion and adds a cfg(unix) multi-frame (~41 KB) ordering test so in-order forwarding is pinned by a non-vacuous test (the echo test's single frame cannot exercise cross-frame order). From PR #634 adversarial review (nit 1, kata e2rj).
spawn_with_sink_does_not_accumulate_captured_messages hardcodes /bin/sh; gate it for hygiene/consistency with the file's existing cfg(unix) usage. The surrounding test module already carries ungated unix-only helpers, so this is intent documentation, not a new platform break. From PR #634 adversarial review (nit 2, kata e2rj).
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.
Addresses the two review nits from PR #634 adversarial review (kata task e2rj).
Changes
perf(terminal): forward sink messages by value in pty reader hot path (commit 7c9c49d)
sink(message.clone())per output frame then dropped originalstest(terminal): gate the unix-only sink test with #[cfg(unix)] (commit 7409816)
Validation