-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tr: Stream output instead of buffering #6012
Conversation
GNU testsuite comparison:
|
3dc2b0f
to
9af8eda
Compare
Changes since last push:
Test output of flaky test `test_split::test_round_robin_limited_file_descriptors`
Sadly, this does not show a backtrace of the failing command. Also, I cannot reproduce this problem. On my machine the command only needs 5 open files at any point in time, so |
GNU testsuite comparison:
|
9af8eda
to
86b12a5
Compare
Changes since last push:
|
86b12a5
to
55eee60
Compare
Changes since last push:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it! Just one suggestion on the link in the comment.
9127b4b
to
8898ba8
Compare
Changes since last push(es):
|
This should lower memory consumption, and fixes OOM in some scenarios.
GNU testsuite comparison:
|
This should lower memory consumption, and fixes OOM in some scenarios.
Before, buggy behavior:
After:
It might be tempting to factor out the common line
translate_input(&mut locked_stdin, &mut buffered_stdout, op);
from all if-branches. However, note thatop
has distinct types in each case, and virtualizing it (e.g.let op: Box<dyn SymbolTranslator>
) would incur additional runtime costs. That cost seems unnecessary just to gain a little bit of beauty.I'm not really sure how to test this. Ideally we could pipe in some data, and NOT close the stdin pipe, and see whether the program produces any partial output. However, I didn't see any methods/functions for doing so, and it sounds like it's too hard to get right to be worth it.
Maybe I could write a
BENCHMARKING.md
file, like forshuf
? What do you suggest?