Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!chinacat!sequoia!rpp386!jfh From: jfh@rpp386.cactus.org (John F Haugh II) Newsgroups: comp.bugs.sys5 Subject: Re: SVR3 Utilities (Was: Re: small bug in who(1) of SVR3) Message-ID: <18948@rpp386.cactus.org> Date: 15 Jan 91 15:27:18 GMT References: <1991Jan13.004843.18650@zoo.toronto.edu> <18899@rpp386.cactus.org> <1991Jan14.202053.20054@zoo.toronto.edu> Reply-To: jfh@rpp386.cactus.org (John F Haugh II) Organization: Lone Star Cafe and BBS Service Lines: 37 X-Clever-Slogan: Recycle or Die. In article igb@fulcrum.bt.co.uk (Ian G Batten) writes: >I don't doubt it. I had to use ``sum'' in a small utility and was >shocked at its performance. When I rewrote it as a function --- rather >than running it down a pipe --- and removed some obvious infelicitudes >it ran about three times faster. That with, oh, half an hour's effort. Well, I do doubt it. Here is a collection of examples. It should be obvious that the pipe loses out over the single C command. Of course, on a system with a load average <1, waste is just fine. % timex who -q jfh jfh jfh root # users=4 execution complete real 0.18 user 0.02 sys 0.08 % timex users jfh root execution complete real 0.19 user 0.00 sys 0.05 % timex /bin/sh -c 'who | cut -d" " -f1 | sort -u | tr \\012 " " ; echo ""' jfh root execution complete real 0.79 user 0.02 sys 0.22 -- John F. Haugh II UUCP: ...!cs.utexas.edu!rpp386!jfh Ma Bell: (512) 832-8832 Domain: jfh@rpp386.cactus.org "While you are here, your wives and girlfriends are dating handsome American movie and TV stars. Stars like Tom Selleck, Bruce Willis, and Bart Simpson."