coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH]: fold: flush after each line


From: Henner Zeller
Subject: Re: [PATCH]: fold: flush after each line
Date: Sun, 5 Jul 2015 13:31:58 -0700

On 5 July 2015 at 13:29, Pádraig Brady <address@hidden> wrote:
> On 05/07/15 21:23, Henner Zeller wrote:
>> On 5 July 2015 at 12:50, Pádraig Brady <address@hidden> wrote:
>>> On 05/07/15 19:54, Henner Zeller wrote:
>>>> The 'fold' utility was not very helpful in streaming contexts as
>>>> outgoing lines where not sent immediately but whenever the buffer was
>>>> full.
>>>>
>>>> Patch attached.
>>>
>>> That would have significant performance impact on the normal case.
>>> We have support for configuring this at runtime though using stdbuf.
>>> The following shows that and the performance difference:
>>>
>>>   $ time yes 12345 | fold -w5 | head -n1M > /dev/null
>>>   real  0m0.393s
>>>   user  0m0.458s
>>>   sys   0m0.017s
>>>
>>>   $ time yes 12345 | stdbuf -oL fold -w5 | head -n1M > /dev/null
>>>   real  0m1.695s
>>>   user  0m0.797s
>>>   sys   0m2.280s
>>>
>>
>> I could hide it behind a flag (which I wanted to avoid initially for
>> less user confusion).
>> Updated patch attached.
>
> Given we have a general way to specify line buffering (stdbuf -oL),
> I don't think we should add an extra option here to duplicate functionality.

Fair enough.
(#TIL: there is a tool called stdbuf :) ).

-h



reply via email to

[Prev in Thread] Current Thread [Next in Thread]