-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
tail
: improve performance when stdin is piped
#3874
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
tail
: improve performance when stdin is piped
#3874
Conversation
c6f494b
to
7b35143
Compare
Cool! It doesn't currently build on the MinRustV job, could you look into that? Also can we test this without those giant files with random noise? Maybe we can generate that data during the test? |
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.
Whoops, selected the wrong option :)
@tertsdiepraam Thanks for your feedback. I'll have a look into it as soon as possible. |
Rewrite handling of stdin when it is piped and read input in chunks. Fixes uutils#3842
Fixes temporary value dropped while borrowed
7b35143
to
d6c561d
Compare
d6c561d
to
d63b98c
Compare
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.
Great work on the tests! I have commented 2 nits. It looks good to me, although I'm currently reading it all on my phone, so I can't really do a full review. It feels a bit verbose in places, but I think we can merge this and simplify it later if the need arises. Excellent work!
Thanks :) |
Since we're processing piped stdin in chunks now (fa51fe8) this limit doesn't apply anymore.
I fixed the failing test on 32-bit systems by removing it. I don't think checking for memory limits for commandline arguments does make much sense and gnu's tail doesn't check either. I still don't know why all the windows tests are failing. All tests with piped in input fail as soon as some output on stdout is expected and it seems on windows systems tail produces no output, at all. I don't have a windows system around right now. Maybe you have an idea? |
Any idea why some tests related to uu_chgrp are failing all of the sudden? |
Dunno but I opened this bug: |
Looks like we're hitting a
|
This doesn' have to do with my changes directly. In the |
I decided to switch off the pipe tests on macos entirely, since also other values than |
Beside trying to fix #3910, I would like to try something else and ignore the write errors to stdin. I readded macos to the pipe tests. |
The tests look promising, no broken pipe errors anymore. The android test is failing but I don't see a relation to this pr. @tertsdiepraam Do you? I had concerns that the input isn't transferred through the pipe completely in case of a write error in |
The Android failure is probably this: #3911. I'll do a final read-through of the PR. |
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.
Looks all good now!
arf :( |
@sylvestre sorry :( I didn't want to force push until everything's alright. I should have written something ... |
no worries, I am taking care of that |
uff. ok |
Push here: What I had done: |
thanks and sorry again |
no worries :) |
Whoops, sorry! @sylvestre |
no problem :) |
Yeah I just forgot to check the commits :) |
@sylvestre yeah thanks but I don't trust such interfaces ;) I'm using git almost only on the command line. |
This pr intends to fix the performance issues described in #3842. In addition to the problems mentioned in #3842 with the
-n {+,-}{values}
option, the-c {+,-}{values}
options were also very slow when reading in large files, which I also addressed in this pr. Basically, this solution uses fixed size byte reads processed in chunks instead of line based reads.So far the performance is comparable to gnu's tail.
Latest benchmarks
I already added some unit tests and integration tests to ensure basic correctness. However, this is currently still a draft and I'm writing on more tests and documenation.
Fixes #3842