Repository navigation
Conversation
| } | ||
|
|
||
| #[test] | ||
| fn test_buffered_file_and_stdin_give_same_expansion() { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
650efa4 to
4645a59
Compare
| clap = { workspace = true } | ||
| fluent = { workspace = true } | ||
| uucore = { workspace = true, features = ["parser"] } | ||
| uucore = { workspace = true, features = ["fs", "parser"] } |
There was a problem hiding this comment.
why is fs needed? uucore::io isn't behind a feature
There was a problem hiding this comment.
error[E0432]: unresolved import `uucore::io`
--> src/uu/expand/src/expand.rs:18:13
|
18 | use uucore::io::InputReader;
| ^^ could not find `io` in `uucore`
|
note: found an item that was configured out
--> src/uucore/src/lib/lib.rs:31:22
|
30 | #[cfg(all(feature = "fs", any(unix, windows, target_os = "wasi")))]
| -------------- the item is gated behind the `fs` feature
31 | pub use crate::mods::io;
| ^^| /// | ||
| /// Keep the stdin lock for the lifetime of the reader, preserving any bytes | ||
| /// buffered between calls to `Read` and `BufRead`. | ||
| pub enum InputReader { |
There was a problem hiding this comment.
unexpand has almost the same enum, could you please switch it to this one too?
d5b5489 to
e5ecaca
Compare
|
GNU testsuite comparison: |
Merging this PR will regress 2 benchmarks
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | cp_recursive_deep_tree[(120, 4)] |
532.6 KB | 699.2 KB | -23.82% |
| ❌ | Memory | du_deep_tree[(100, 3)] |
76.5 KB | 82.4 KB | -7.14% |
| ⚡ | Simulation | true_consecutive_calls |
350.2 ns | 294.7 ns | +18.85% |
| ⚡ | Simulation | expand_custom_tabstops[50000] |
31.6 ms | 29.3 ms | +8.05% |
| ⚡ | Simulation | expand_many_lines[100000] |
115.9 ms | 107.4 ms | +7.92% |
| ⚡ |
Simulation | du_deep_tree[(100, 3)] |
1.9 ms | 1.9 ms | +4.48% |
| ⚡ | Simulation | uniq_case_insensitive[10000] |
2.9 ms | 2.8 ms | +4.45% |
| ⚡ | Simulation | uniq_with_count[10000] |
3.6 ms | 3.5 ms | +3.59% |
| ⚡ |
Simulation | uniq_heavy_duplicates[10000] |
4.1 ms | 4 ms | +3.06% |
| ⚡ | Simulation | uniq_check_chars[(10000, "1")] |
4.2 ms | 4.1 ms | +3.04% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing limadog9:fix/io-concrete-buffered-input-11811 (b801d2b) with main (ae34722)2
Footnotes
-
70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
No successful run was found on
main(198c615) during the generation of this report, so ae34722 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
e5ecaca to
60fc39a
Compare
| #[cfg(not(windows))] | ||
| type NativeType = OwnedFd; | ||
|
|
||
| /// File or standard input without boxing a trait object. |
There was a problem hiding this comment.
| /// File or standard input without boxing a trait object. | |
| /// Represents an input source, either standard input or a file. |
try to avoid narrating the diff in comments
Use a shared file/stdin enum in expand, unexpand and uniq so reading needs no boxed trait object. Generic source types preserve unexpand's existing outer buffer; other callers keep buffered files and locked stdin. Declare fs in all three standalone utility dependencies. Validation: 128 integration tests, Clippy, standalone benchmark checks and Windows compilation pass. Local release timings on the two unexpand benchmark inputs remain within 3% of the base; CodSpeed must confirm the reported simulation regression is resolved. Refs uutils#11811.
60fc39a to
b801d2b
Compare
|
Updated the doc comment as suggested. Also verified that expand, unexpand, and uniq each enable uucore/fs and pass standalone checks, including their binaries and benchmarks. |
Use a shared file/stdin enum in expand and uniq so reading needs no boxed trait object. Test mixed buffered/direct reads and both input sources.
Refs #11811.