HEADS DOWN

Bruce Evans bde at zeta.org.au
Wed May 9 10:08:49 UTC 2007


On Wed, 9 May 2007, Andrey Chernov wrote:

> On Tue, May 08, 2007 at 04:37:03PM -0500, Sean C. Farley wrote:
>>  Would it be preferred to go ahead to use strlen() in preparation for a
>>  faster strlen() in the future?
> ...
> we can use strlen() in preparation for the future.

Yes, it is better to use library functions if they do (almost) exactly what
is wanted.

>>  I would still use the inline'd version
>>  when counting characters while watching for an '=' character.  Or should
>>  it also be changed to perform a strlen() and then a strchr()?
>
> Combined strlen()+strchr() will be slower in any case than single loop, so
> better leave it as is.

The compiler could in theory reduce to a single loop, but I've never seen
one that does and would use the loop myself.

Bruce


More information about the freebsd-arch mailing list