perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dariusz Pietrzak <dari...@ajax.umcs.lublin.pl>
Subject Parser optimisation
Date Mon, 28 May 2001 08:30:48 GMT
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;



--
Dariusz Pietrzak
Certified Nobody


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


Mime
View raw message