Useless loop?

Christopher R. Hertel crh at nts.umn.edu
Thu Nov 4 19:09:14 GMT 1999


Yes, but this sort of thing adds up.  Overall, you're still probably 
right that it won't be much impact.

For argument's sake, though, it's not just the counter.  There are also
ngroups + 2 comparisons of the form DEBUGLEVEL >= 3.  These can be reduced
to 1 comparison using the DEBUGLVL() macro instead of multiple DEBUG()
calls. 

Chris -)-----

> "Naccarato, Robert" wrote:
> > 
> > DEBUG( 3, ( "%s is in %d groups: ", user, ngroups ) );
> > for (i = 0; i < ngroups; i++ )
> > {
> >         DEBUG( 3, ( "%s%d", (i ? ", " : ""), (int)groups[i] ) );
> > }
> > DEBUG( 3, ( "\n" ) );
> 
> You are technically correct.  However, in my experience most 
> users are only in a few groups (2 - 3 maybe).  On the high
> end a sysadmin may be in 16 groups.  Therefore ngroups
> is fairly low and should not really cost you much to loop.
> 
> 
> 
> 
> 
> Cheers,
> jerry
> ________________________________________________________________________
>                             Gerald ( Jerry ) Carter	
> Engineering Network Services                           Auburn University 
> jerry at eng.auburn.edu             http://www.eng.auburn.edu/users/cartegw
> 
>        "...a hundred billion castaways looking for a home."
>                                   - Sting "Message in a Bottle" ( 1979 )
> 


-- 
             -- I have a shoehorn, the kind with teeth. --
                                  ---
Christopher R. Hertel -)-----                   University of Minnesota
crh at nts.umn.edu              Networking and Telecommunications Services


More information about the samba-technical mailing list