[mdlug] UNIX tips: Learn 10 good UNIX usage habits
Robert Citek
robert.citek at gmail.com
Tue Mar 11 13:12:30 EDT 2008
On Tue, Mar 11, 2008 at 10:47 AM, Mathew Enders
<mathew.enders at prodigy.net> wrote:
> On Tue, 2008-03-11 at 06:12 -0500, Robert Citek wrote:
> > BTW, this is my laptop running Ubuntu 7.10 with dual 2GHz cpus and 1
> > GB RAM. Not a screamer by any stretch.
>
> My laptop is a 500Mhz Celeron with 512MB of ram so screamer would be a
> relative term
Good point. So I tried it on a different machine.
Hardware:
400 MHz Celeron
64 MB RAM
3 GB HDD
Script, slightly modified from Robert (couldn't do the 200MM because I
didn't have enough free disk space):
(
mkdir -p tmp/a/
tmpfile=tmp/a/longfile.txt
for COUNT in 2 20000000; do
yes and | head -$COUNT > $tmpfile
time -p grep -c and $tmpfile
time -p < $tmpfile grep -c and
time -p cat $tmpfile | grep -c and
done \
>& output.txt
)
Results:
2
real 0.05
user 0.02
sys 0.00
2
real 0.03
user 0.02
sys 0.00
2
real 0.06
user 0.04
sys 0.02
20000000
real 21.31
user 13.60
sys 0.78
20000000
real 19.71
user 13.40
sys 0.90
20000000
real 19.14
user 13.96
sys 1.67
Conclusion:
1) For the 95% of the time where cat+pipe is inefficient, it doesn't
matter. So, don't worry about it.
2) Do the experiment yourself to verify the data. Don't believe
everything you read on the internet.
3) 87.4% of all statistics are made up on the spot.
Regards,
- Robert
More information about the mdlug
mailing list