From owner-freebsd-questions Sat Feb 17 21:18:40 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 8176437B684 for ; Sat, 17 Feb 2001 21:18:34 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id QAA15923; Sun, 18 Feb 2001 16:18:03 +1100 Date: Sun, 18 Feb 2001 16:17:34 +1100 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: cjclark@alum.mit.edu Cc: Cliff Sarginson , Peter Pentchev , Artem Koutchine , questions@FreeBSD.ORG Subject: Re: Efficiency [Was: Re: rpc.statd attack] In-Reply-To: <20010217165124.C62368@rfx-216-196-73-168.users.reflex> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG [security removed from cc list] On Sat, 17 Feb 2001, Crist J. Clark wrote: > On Fri, Feb 16, 2001 at 03:03:44PM +0000, Cliff Sarginson wrote: > > [snip] > > > As you can see makes all the difference :) > > But this is under Solaris ... > > > > $ time rpcinfo -p | egrep -e 'udp.*status$' | awk '{print $4}' > > 32790 > > > > real 0m0.12s > > user 0m0.04s > > sys 0m0.07s > > > > $ time rpcinfo -p | awk '($3 == "udp") && ($5 == "status") {print $4 }' > > 32790 > > > > real 0m0.11s > > user 0m0.05s > > sys 0m0.04s > > Shocking. rpcinfo takes the same amount of time to run in both > examples. You are not incuding the awk's and grep's in your > measurements. This is not clear, and probably isn't true, since the above doesn't use time(1) to do the timing. > ITYM, > > $ rpcinfo -p | time egrep -e 'udp.*status$' | time awk '{print $4}' > 996 > 0.05 real 0.00 user 0.00 sys > 0.04 real 0.00 user 0.00 sys > > $ rpcinfo -p | time awk '($3 == "udp") && ($5 == "status") {print $4 }' > 996 > 0.03 real 0.00 user 0.00 sys Note the different format produced by time(1) with no options. `time -p' would produce ugly multi-line output, but not compatibly ugly with the above. The above might be produced by bash-2's `time' keyword. One of the many incompatibilities of bash-2's `time' is that it times whole pipelines. It is so incompatibile that I upgraded from bash-2 to bash-1 just to avoid it. I was most annoyed by it breaking redirection, e.g., "time make world >world.log 2>&1" prints the time on the terminal, not in world.log. In bash-2, `time' is a keyword, not a builtin, so it can't even be declared away by making it a function. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message