Repository navigation
perf(stream): drop the unread stdout copy in the CaptureOnly arm - #3850
Open
wilyan09007 wants to merge 1 commit into
Open
wilyan09007 wants to merge 1 commit into
wilyan09007 wants to merge 1 commit into
Conversation
run_streaming's CaptureOnly branch finished reading the child's stdout into raw_stdout and then cloned the whole buffer into StreamResult.filtered, up to the 10 MiB RAW_CAP, on every capture-mode command. Nothing reads it there. Both CaptureOnly call sites, run_captured_filter in runner.rs and uv_cmd, work off raw, raw_stdout and raw_stderr; the three readers of filtered (runner.rs, git.rs, search.rs) are all on FilterMode::Streaming calls, and saved_filter, the one path that appends to filtered after the read loop, is only set in the streaming branch. Leave filtered empty there and say so on the field. The test that asserted the copy existed now spawns a child emitting ~1 MiB and checks that raw_stdout still carries it while filtered stays empty. Signed-off-by: William <[email protected]>
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.
Summary
run_streaming'sCaptureOnlyarm cloned all ofraw_stdoutintoStreamResult.filtered, up to the 10 MiBRAW_CAP, on every capture-mode command.filteredon that path: bothCaptureOnlycall sites (run_captured_filterinrunner.rs, anduv_cmd) work offraw/raw_stdout/raw_stderr, and the three readers offilteredinrunner.rs,git.rsandsearch.rsall sit onFilterMode::Streamingcalls.filteredempty.Test plan
cargo fmt --all && cargo clippy --all-targets && cargo testrtk <command>output inspectedtest_run_streaming_capture_only_filtered_equals_rawasserted the copy existed. It is replaced bytest_run_streaming_capture_only_leaves_filtered_empty, which spawns a child emitting ~1 MiB and checks thatraw_stdoutstill carries it whilefilteredstays empty.Fixes #3397