Bug in users command
Bill Davidson
billd at fps.com
Mon Jan 21 16:49:41 AEST 1991
In article <19095:Jan1916:41:3291 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>In article <14902 at celit.fps.com> billd at fps.com (Bill Davidson) writes:
>> #!/bin/sh
>> USERS=`who|sort|awk '{print $1}'`
>> echo $USERS
>
>Okay, timings: The perl version is about ten times as slow as the PD C
>version and the Berkeley C version. The shell script is about twice as
>slow as that. The perl version uses ten times as much memory as the C
>versions, and five times as much memory as the shell script.
>
>Now can someone give me one good reason that Berkeley should distribute
>the Perl or sh version rather than the C version?
No. Not really. I've always thought that "users" was a bit of a silly
program to have though. I've always found "who" and "finger" to be
much more useful.
>30 lines of C code is hardly a maintenance problem
Agreed. It would be nice if it worked properly though.
>and on a system with fifty undergraduates
>running automatic utmp checks every minute in the background, the
>difference between C and Perl is the difference between a 2% extra load
>and a 20% extra load.
Huh? Your undergrads run "users" every minute? REALLY????!!!!
Bizarre.
Would you explain this please?
--Bill Davidson
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list