apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject Re: cvs commit: apr/test teststr.c .cvsignore Makefile.in
Date Thu, 24 May 2001 15:06:39 GMT
Jeff Trawick <trawickj@bellsouth.net> writes:

> >   Add apr_strtok(), a thread-safe flavor of strtok() which has the
> >   same interface as strtok_r().
...
> Some eager person may wish to replace the strchr() calls with inline
> code.  The only compiler I'm really familiar with w.r.t. code
> generation will replace strchr() with inline code but I suspect that
> is not the case with most compilers.

IMHO, the usefulness of replacing the strchr() calls with inline code
has nothing to do with the efficiency of the strchr() in the C
library.  Whether or not the C library strchr() it is written in
assembler, I'm willing to bet that it is fast.

I think the usefulness of having inline code in this situation is
because:

1) function call overhead is gone (on at least one platform/compiler I
   know, the cost of the function call is >= than the cost of
   strchr())

2) the code for strchr() is visible when the calling function is
   optimized, leading to better code than when part of the work has to
   be done in code the optimizer won't see

(This being said, I don't personally intend to look at this code again
unless it breaks or we start calling apr_strtok() all over the place
:) )

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...


Mime
View raw message