On Mon, 27 Mar 100, T.E.Dickey wrote:

> >  Here is a patch I promised - it replaces strcpy with faster mempcy in the 
> > most used string functions HTSACopy and HTSACat (used via macros StrAllocCopy 
> > and StrAllocCat). 
> >  
> >  Best regards, 
> >   -Vlad 
> >  
> > diff -ru old/WWW/Library/Implementation/HTString.c 
>fixed/WWW/Library/Implementation/HTString.c 
> > --- old/WWW/Library/Implementation/HTString.c       Thu Nov  4 00:31:15 1999 
> > +++ fixed/WWW/Library/Implementation/HTString.c     Mon Mar 27 20:06:58 2000 
> > @@ -269,11 +269,12 @@ 
> >  { 
> >      if (src != 0) { 
> >     if (src != *dest) { 
> > +       int srclen = strlen(src); 
> 
> close (srclen should be an unsigned type, i.e., size_t).
> 
> but have you measured this?  (on some implementations, strcpy is inlined,
> so it's much the same).

  Yes, I did it. But I've got a fast PC - so no difference seen (I did a small
test by time'ing a shell script that invokes lynx to -dump to /dev/null one
900K file 7 times).
  But seems memcpy should be about 4 times faster on 32 bit machines and 8x on
64 bit machines if it was properly optimized, and it is probably inlined too
(though less likely than strcpy).
 
> -- 
> Thomas E. Dickey
> [EMAIL PROTECTED]
> http://www.clark.net/pub/dickey
> 

 Best regards,
  -Vlad

Reply via email to