Date: Sun, 18 Feb 2001 16:17:34 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: cjclark@alum.mit.edu Cc: Cliff Sarginson <cliff@raggedclown.net>, Peter Pentchev <roam@orbitel.bg>, Artem Koutchine <matrix@ipform.ru>, questions@FreeBSD.ORG Subject: Re: Efficiency [Was: Re: rpc.statd attack] Message-ID: <Pine.BSF.4.21.0102181554560.1992-100000@besplex.bde.org> In-Reply-To: <20010217165124.C62368@rfx-216-196-73-168.users.reflex>
next in thread | previous in thread | raw e-mail | index | archive | help
[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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0102181554560.1992-100000>
