Repository navigation
Conversation
|
|
||
| [target.'cfg(unix)'.dependencies] | ||
| rustix = { workspace = true, features = ["fs"] } | ||
| rustix = { workspace = true, features = ["fs", "pipe"] } |
This comment was marked as low quality.
This comment was marked as low quality.
Sorry, something went wrong.
This comment was marked as low quality.
This comment was marked as low quality.
Sorry, something went wrong.
| // Increasing the output pipe capacity is optional and may be done once by | ||
| // callers that copy several inputs into the same output. | ||
| let _ = fcntl_setpipe_size(&mut *dest, MAX_ROOTLESS_PIPE_SIZE); | ||
| splice_unbounded_broker(source, dest) | ||
| } | ||
|
|
||
| /// Copy through a cached broker pipe without changing the output pipe capacity. | ||
| /// | ||
| /// Callers copying multiple sources may prepare their output once and reuse | ||
| /// this operation for each source. A failure to resize never prevents copying. | ||
| #[inline] | ||
| pub fn splice_unbounded_broker(source: &impl AsFd, dest: &mut impl AsFd) -> SpliceRes { |
This comment was marked as low quality.
This comment was marked as low quality.
Sorry, something went wrong.
This comment was marked as low quality.
This comment was marked as low quality.
| // fcntl for input would not improve throughput since | ||
| // - sender with splice probably increased size already | ||
| // - sender without splice is bottleneck |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
c4d75cf to
34525a4
Compare
| // All operands share stdout. Resize its pipe once, even if the kernel | ||
| // refuses the optional increase, rather than retrying for every file. |
There was a problem hiding this comment.
| // All operands share stdout. Resize its pipe once, even if the kernel | |
| // refuses the optional increase, rather than retrying for every file. | |
| // All operands share stdout. Try to resize it once. |
34525a4 to
c7f35d0
Compare
| I: IntoIterator<Item = &'a OsString>, | ||
| { | ||
| #[cfg(any(target_os = "linux", target_os = "android"))] | ||
| if options.can_print_fast() { |
There was a problem hiding this comment.
the description mentions a regression test for mixed file/stdin order but i don't see it in the commit, please add it in tests/by-util/test_cat.rs
There was a problem hiding this comment.
I don't think this PR needs a test since it is performance-related PR.
There was a problem hiding this comment.
If we test something, it should count pipe2 call by strace.
a regression checks mixed file/stdin output order is unrelated with this PR.
| /// Copy through a cached broker pipe without changing the output pipe capacity. | ||
| /// | ||
| /// Callers copying multiple sources may prepare their output once and reuse | ||
| /// this operation for each source. A failure to resize never prevents copying. |
There was a problem hiding this comment.
this function never resizes, so "a failure to resize never prevents copying" is confusing here. could you please make this doc one line?
There was a problem hiding this comment.
I think we don't need this comment.
c7f35d0 to
736f4f1
Compare
Merging this PR will not alter performance
|
736f4f1 to
adfcce3
Compare
|
Added the requested strace regression |
| } | ||
|
|
||
| #[test] | ||
| fn test_fast_copy_mixed_file_and_stdin_order() { |
There was a problem hiding this comment.
Would you remove unrelated test and update 1st comment to mention strace test instead?
|
|
||
| let scene = TestScenario::new(util_name!()); | ||
| let probe = Command::new("strace") | ||
| .args(["-qq", "-o", "/dev/null", "-e", "trace=none"]) |
There was a problem hiding this comment.
I think we can check support of syscalls by kernel at here instead of trace=none.
| let probe = Command::new("strace") | ||
| .args(["-qq", "-o", "/dev/null", "-e", "trace=none"]) | ||
| .arg(&scene.bin_path) | ||
| .args(["cat", "--help"]) |
There was a problem hiding this comment.
I think --version is faster, or cat /dev/null is making a sense.
There was a problem hiding this comment.
Moreover, we don't need 2 strace at here if we used cat /dev/null /dev/null.
Prepare stdout pipe capacity once and reuse the broker copy for every input. On 30 files, resize attempts fall from 31 to 2. Add a strace regression using cat /dev/null /dev/null to check one broker pipe and two resize attempts. Detect unavailable syscalls from the same trace rather than launching a separate probe. Closes uutils#11700.
adfcce3 to
74bd78d
Compare
Prepare stdout's pipe capacity once and reuse the broker copy for every input. On 30 files, resize attempts fall from 31 to 2. A strace regression checks one broker pipe and two resize attempts with cat /dev/null /dev/ null.
Closes #11700.