httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@covalent.net>
Subject Re: [PATCH] performance fix for mod_include
Date Sat, 10 Nov 2001 18:38:22 GMT
On Saturday 10 November 2001 10:34 am, Cliff Woolley wrote:
> On Fri, 9 Nov 2001, Brian Pane wrote:
> > This patch zero-fills just the integer and pointer fields in
> > the structure, plus the first byte of each of the string buffers.
> > With the patch, I'm seeing a 19% improvement in SSI throughput
> > in informal testing (ab running a single request at a time,
> > over the loopback on Linux).
> >
> >+         */
> >+        f->ctx = ctx = apr_palloc(f->c->pool, sizeof(*ctx));
> >+        memset(f->ctx, 0, (void *)&(ctx->error_str) - (void *)ctx);
> >+        ctx->error_str[0] = 0;
> >+        ctx->time_str[0] = 0;
> >         if (ctx != NULL) {
>
> You can't do arithmetic on void pointers, and you're converting from a
> pointer to a size_t without a cast.  I think it should be this:
>
> memset(f->ctx, 0, (size_t)((char *)&(ctx->error_str) - (char *)ctx));

No offense, but that is an ugly line of code.  :-)  I really think that
error_str and time_str can just be removed from that structure.  That would
allow us to not add the casts, and it would speed up that function.  I'll do that
work sometime this week unless somebody beats me to it.

Ryan
______________________________________________________________
Ryan Bloom				rbb@apache.org
Covalent Technologies			rbb@covalent.net
--------------------------------------------------------------

Mime
View raw message