[mdlug] UNIX tips: Learn 10 good UNIX usage habits

Aaron Kulkis akulkis3 at hotpop.com
Tue Mar 11 21:27:18 EDT 2008


Aaron Kulkis wrote:
> Robert Citek wrote:
>> On Mon, Mar 10, 2008 at 1:54 PM, Aaron Kulkis <akulkis3 at hotpop.com> wrote:
>>>  You write a shell script to do some task...
>>>
>>>  And then someone else writes a shell-script, which has a giant
>>>  for loop and calls your script in their script....
>>>
>>>  It's ridiculous cpu cycle waste...
>> Figured I'd try to replicate the authors work
>>
>> $ yes and | head -20000000 > tmp/a/longfile.txt
>>
>> $ time grep -c and tmp/a/longfile.txt
>> 20000000
>>
>> real    0m2.142s
>> user    0m1.340s
>> sys     0m0.036s
>>
>> $ time cat tmp/a/longfile.txt | grep -c and
>> 20000000
>>
>> real    0m1.383s
>> user    0m1.344s
>> sys     0m0.108s
>>
> 
> System time went from 0.036s to 0.108s.
> That's a factor of 3.

http://en.wikipedia.org/wiki/List_of_strange_units_of_measurement#Light-nanosecond





More information about the mdlug mailing list