Re: [mp2] [PATCH] implement ap_save_brigade

[prev] [thread] [next] [Date index for 2005/05/09]

From: Stas Bekman
Subject: Re: [mp2] [PATCH] implement ap_save_brigade
Date: 21:37 on 09 May 2005
Dorian Taylor wrote:
> no tests currently, but there's a module on cpan that uses it.
> 
> http://search.cpan.org/~DORIAN/Apache-TrapSubRequest-0.01/

Thanks Dorian, please see comments below.

> ------------------------------------------------------------------------
> 
> diff -ur mod_perl-2.0.0-RC4/lib/Apache/ParseSource.pm mod_perl-2.0.0-RC4-djt/lib/Apache/ParseSource.pm
> --- mod_perl-2.0.0-RC4/lib/Apache/ParseSource.pm	Fri Jan  7 01:17:50 2005
> +++ mod_perl-2.0.0-RC4-djt/lib/Apache/ParseSource.pm	Fri Feb 11 08:22:37 2005
> @@ -138,7 +138,7 @@
>                                      apr_optional mod_include mod_cgi
>                                      mod_proxy mod_ssl ssl_ apr_anylock
>                                      apr_rmm ap_config mod_log_config
> -                                    mod_perl modperl_ apreq);
> +                                    mod_perl modperl_ apreq mod_transform mod_.*svn);
>          $unwanted = qr|^$unwanted|;
>          my $wanted = '';

How is that related?

> diff -ur mod_perl-2.0.0-RC4/xs/Apache/Filter/Apache__Filter.h mod_perl-2.0.0-RC4-djt/xs/Apache/Filter/Apache__Filter.h
> --- mod_perl-2.0.0-RC4/xs/Apache/Filter/Apache__Filter.h	Fri Jan  7 01:17:40 2005
> +++ mod_perl-2.0.0-RC4-djt/xs/Apache/Filter/Apache__Filter.h	Thu Feb 10 20:33:58 2005
> @@ -365,3 +365,20 @@
>  
>      return rc;
>  }
> +
> +static MP_INLINE
> +apr_status_t mpxs_Apache__Filter_save_brigade(pTHX_ ap_filter_t *f,
> +                                              apr_bucket_brigade *saveto,
> +                                              apr_bucket_brigade *bb,
> +                                              apr_pool_t *p)
> +{
> +    apr_status_t rc = ap_save_brigade(f, &saveto, &bb, p);
> +    /* if users don't bother to check the success, do it on their
> +     * behalf */
> +    if (GIMME_V == G_VOID && rc != APR_SUCCESS) {
> +        modperl_croak(aTHX_ rc, "Apache::Filter::save_brigade");
> +    }
> +
> +    return rc;
> +}
> +
> diff -ur mod_perl-2.0.0-RC4/xs/maps/apache_functions.map mod_perl-2.0.0-RC4-djt/xs/maps/apache_functions.map
> --- mod_perl-2.0.0-RC4/xs/maps/apache_functions.map	Fri Jan  7 01:17:39 2005
> +++ mod_perl-2.0.0-RC4-djt/xs/maps/apache_functions.map	Thu Feb 10 22:59:18 2005
> @@ -245,7 +245,9 @@
>  !ap_register_output_filter
>  -ap_remove_output_filter
>  -ap_remove_input_filter
> -!ap_save_brigade
> +~ap_save_brigade
> + mpxs_Apache__Filter_save_brigade | | \
> +    f, saveto, bb, p=(f->r ? f->r->pool : NULL) | save_brigade
>   ap_filter_flush
>  ~ap_fflush
>   mpxs_Apache__Filter_fflush

So you think this approach will be faster than flattening bb on each 
filter invocation and concatenating the scalar?

sub Apache::SubRequest::run_trapped {
     my ($r, $sref) = @_;
[...]
     $bb->flatten(my $data);
     $$sref = $data;
     $rv;

why not make the API that does run_trapped($data) and save the copying of 
what could be a huge data with:

sub Apache::SubRequest::run_trapped {
     my $r = shift;
[...]
     $bb->flatten($_[1]);

        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

(message missing)

[mp2] [PATCH] implement ap_save_brigade
Dorian Taylor 18:22 on 09 May 2005

Re: Decaying Performance under newer apache/mp versions
Ricardo Ramos Massaro 20:08 on 09 May 2005

Re: [mp2] [PATCH] implement ap_save_brigade
Stas Bekman 21:37 on 09 May 2005

Re: [mp2] [PATCH] implement ap_save_brigade
Dorian Taylor 22:21 on 09 May 2005

Re: [mp2] [PATCH] implement ap_save_brigade
Stas Bekman 23:00 on 09 May 2005

Re: [mp2] [PATCH] implement ap_save_brigade
Dorian Taylor 23:30 on 09 May 2005

Re: [mp2] [PATCH] implement ap_save_brigade
Stas Bekman 01:31 on 10 May 2005

Re: [mp2] [PATCH] implement ap_save_brigade
Stas Bekman 05:13 on 13 May 2005

Re: [mp2] [PATCH] implement ap_save_brigade
Dorian Taylor 19:48 on 17 May 2005

Re: [mp2] [PATCH] implement ap_save_brigade
Stas Bekman 19:51 on 17 May 2005

Generated at 15:53 on 25 May 2005 by mariachi v0.52