apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: apr_strcat optimization(s)
Date Wed, 20 Jun 2001 19:15:07 GMT
Doug MacEachern wrote:
> 
> On Wed, 20 Jun 2001, Ben Laurie wrote:
> 
> > Err, cp[len]='\0', perlease!
> 
> ok.
> 
> > Its probably worth a fraction of a microsecond (or more) to put this at
> > the end, btw.
> 
> at the end, like this?  interested, how is it faster?

Because of caching - the right bit of memory is likely to be already in
the write cache...

Cheers,

Ben.

> 
> --- srclib/apr/strings/apr_strings.c    2001/06/19 20:40:22     1.14
> +++ srclib/apr/strings/apr_strings.c    2001/06/20 16:56:34
> @@ -130,7 +130,6 @@
> 
>      res = (char *) apr_palloc(a, len + 1);
>      cp = res;
> -    *(cp + len) = '\0';
> 
>      /* Pass two --- copy the argument strings into the result space */
> 
> @@ -145,6 +144,8 @@
>      va_end(adummy);
> 
>      /* Return the result string */
> +
> +    res[len] = '\0';
> 
>      return res;
>  }

--
http://www.apache-ssl.org/ben.html

In Boston 'til 1st July.

Mime
View raw message