perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Chamas <jos...@chamas.com>
Subject Re: Parser optimisation
Date Mon, 28 May 2001 20:38:02 GMT
Dariusz Pietrzak wrote:
> 
> Hello,
>  I've noticed that parser uses substitute call for parsing,
> changed that and got such results:
> 
> New code: 7 wallclock secs ( 7.05 usr +  0.08 sys =  7.13 CPU) @ 14.03/s
> (n=100)
> Old code: 9 wallclock secs ( 8.45 usr +  0.06 sys =  8.51 CPU) @ 11.75/s
> (n=100)
> Diff: -2 wallclock secs (-1.40 usr +  0.02 sys = -1.38 CPU)
> 
> These are of course over-optimistic - test .asp was more then 5k long,
> and I measured just the parsing speed, but hey - any gain in efficency is
> good, right?
> 
> Here's the diff against ASP.pm
> --- /usr/lib/perl5/Apache/ASP.pm        Tue Mar 27 21:34:42 2001
> +++ ASP.pm      Tue May 15 09:24:12 2001
> @@ -1085,7 +1085,7 @@
> 
>      my(@out, $perl_block, $last_perl_block);
>      $$data .= "<%;;;%>"; # always end with some perl code for parsing.
> -    while($$data =~ s/^(.*?)\<\%(.*?)\%\>//so) {
> +    while($$data =~ /(.*?)\<\%(.*?)\%\>/gso) {
>         ($text, $perl) = ($1,$2);
>         $perl_block = ($perl =~ /^\s*\=(.*)$/so) ? 0 : 1;
>         my $perl_scalar = $1;
> 

I'm not convinced that this does the right thing.  If you don't
consume the head of the data, then 2nd,3rd,etc ASP block should
not be picked up correctly.  Does a regexp parser know that it
should pick up where it left off from the last match in the string?
I have never seen that behavior documented if it is correct.

Note that you can precompile all the scripts at apache startup in 
the parent with Apache::ASP->Loader(), see 

  http://www.apache-asp.org/tuning.html#Precompile%20Scripts

The point is that all the child httpds don't have to recompile
so you end up with a x MaxClients compiling savings.

--Josh

_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks <- Web Link Checking          Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Mime
View raw message