On 10/03/15 21:18, Ole Tange wrote:
> On Tue, Mar 10, 2015 at 1:31 AM, Giuseppe Scrivano <[email protected]> wrote:
> 
>> $ time src/yes `echo {1..2000}` | head -c 2000M | md5sum
>> 55c293324aa6ecce14f0bf30da5a4686  -
>>
>> real    0m7.994s
>> user    0m11.093s
>> sys     0m2.953s
>>
>> versus (with the patch):
>>
>> $ time src/yes `echo {1..2000}` | head -c 2000M | md5sum
>> 55c293324aa6ecce14f0bf30da5a4686  -
>>
>> real    0m3.534s
>> user    0m4.164s
>> sys     0m1.803s
> 
> Are you sure your are not limited by md5sum?
> 
> $ time yes "`echo {1..2000}`" | head -c 2000M >/dev/null
> 
> real    0m0.660s
> user    0m0.180s
> sys     0m1.115s
> 
> The solution should perform no worse than that.

Two separate cases. Yours above is a single large argument.
Giuseppe's example above, and your original problematic example
were without quotes, and so with many arguments passed to yes.
I've applied Giuseppe's patch with an augmented test.

cheers,
Pádraig.




Reply via email to