httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Marr <>
Subject Re: cvs commit: apache-2.0/src/main http_core.c http_protocol.c
Date Tue, 03 Oct 2000 20:02:43 GMT
At 03:39 PM 10/03/2000, wrote:
>On Tue, 3 Oct 2000, Bill Stoddard wrote:
> > > ap_r*.  These are older functions.  They are likely to always 
> work,
> > > because they are very useful.  Currently, they have horrendous
> > > performance.  The way to solve this, is to allow ap_r* to 
> buffer data.  If
> > > multiple calls to ap_r* are made, the buckets should be 
> buffered until it
> > > is worth it to send the data.
> >
> > I just reread this and I completely disagree. ap_r* needs to 
> coalesce data in
> > addition to buffering buckets. ap_r* routines can never be sure 
> of the scope of
> > the storage passed to them, so you will need to setaside all the 
> calls. It makes
> > more sense to just explicitly alloc an output buffer inside ap_r* 
> and copy bytes
> > into that buffer. When you meet your threshold conditions, turn 
> that buffer into
> > a bucket of suitable type and send it down the chain.
>So, in other words, if a handler allocates small chunks of data and 
>uses ap_r* to write it, we will copy once in the handler, once in 
>ap_r* and potentially once more in core_fitler.  As opposed to 
>copying once in the handler and potentially once more in the 
>core_filter.  Doing coalescing at the top of the stack just doesn't 
>make sense, because we have no idea if coalescing makes sense 
>there.  The only filter that really knows when to coalesce is the core.

If you don't copy at all in ap_r*, you're setting yourself up for 
trouble.  You can't buffer this without copying:

char buf[100];
int i;
int write = 0;

for(i = 0; i < 100; ++i)
     sprintf(buf, "This is line number %d\n", write++);
     ap_rputs(buf, r);

If you're already going to have to copy, why not coalesce at the same 

Greg Marr
"We thought you were dead."
"I was, but I'm better now." - Sheridan, "The Summoning"

View raw message