httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@covalent.net
Subject Re: ap_r* performance patch
Date Wed, 24 Jan 2001 00:11:41 GMT

> On Mon, Jan 22, 2001 at 09:14:35PM -0800, rbb@covalent.net wrote:
> >...
> > > 2) large writes in ap_rputs, ap_rvputs, ap_rwrite, and ap_vrprintf
> > >    specifically: how will you avoid copying the content into the brigade?
> > 
> > Please cross #2 off this list.  The following patch modifies
> > default_handler to print a string of 100,000 'a's using the ap_write
> > API.  This is done with NO copies, and no heap corruption.
> 
> Consider the following (pseudo) code:
> 
> void do_output()
> {
>     char buf[10000];  /* larger than 9k */
>     
>     bb = apr_brigade_create();
> 
>     memset(buf, 'a', sizeof(buf));
>     apr_brigade_write(bb, buf, sizeof(buf));
>     
>     memset(buf, 'b', sizeof(buf));
>     apr_brigade_write(bb, buf, sizeof(buf));
>     
>     ap_pass_brigade(r->output_filters, bb);
> }

This will actually generate 10k of a's, and it will insert those into the
brigade, it will then overwrite those 10k of a's with 10k of b's
(modifying the original a's in the process).  The output will end up being
20k of b's, yes.  In other words, if somebody writes bad code, we won't
work properly.  This hardly seems like a good argument for not using a
patch that performs better and solves the problem in a much more general
way.  Regardless, please drop this.  The patch has been removed, so commit
yours and move on.

Ryan
_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Mime
View raw message