[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Timing: first results : 30%



Happy new year, all.

This week-end i found interesting improvements in execution time.
Here is a typical timing when building my site pages:

** WML:Verbose: main |  ipp   mhc   epl  gm4  div asub hfix hstr slic | TOTAL
** WML:Verbose: ---- | ---- ----- ----- ---- ---- ---- ---- ---- ---- | ------
** WML:Verbose: 0.89 | 7.97  7.53  5.23 0.16 0.14 0.10 0.36 0.31 0.63 | 23.32
                       ^^^^
                     look here

The first pass is the most significant, even if actions during this pass
are quite simple and straightforward. It's why i proposed to include
files verbatim. In fact, most of the time is spent in comment block parser.
When disabling this parser, timing becomes

** WML:Verbose: main |  ipp   mhc   epl  gm4  div asub hfix hstr slic | TOTAL
** WML:Verbose: ---- | ---- ----- ----- ---- ---- ---- ---- ---- ---- | ------
** WML:Verbose: 0.82 | 0.66  7.49  5.01 0.17 0.14 0.08 0.34 0.31 0.63 | 15.65

In my source files, i have a line
#include "packages.wml"
This file ``packages.wml'' contains ``#use'' directives ; in this case,
it includes 10 packages. I type
prompt> wml -p1 packages.wml > packages.pass1
and replace the previous line by
#include "packages.pass1"

Results are:
** WML:Verbose: main |  ipp   mhc   epl  gm4  div asub hfix hstr slic | TOTAL
** WML:Verbose: ---- | ---- ----- ----- ---- ---- ---- ---- ---- ---- | ------
** WML:Verbose: 0.82 | 0.53  7.43  5.09 0.16 0.15 0.09 0.33 0.33 0.69 | 15.62

>From 8 seconds to half a second, this is really nice. Now one has to
work on steps 2 and 3.

Here is the patch i wrote. It is really simple, and needed minimal
testings. It invokes parseblock only if a sequence '/*' is found in
input files. Perl gurus may want to optimize BlockParser.pm, i can't.

################## File wml-ipp.patch ##############################
--- wml-1.6.7/wml_backend/p1_ipp/ipp.src	Thu Jul 30 10:22:16 1998
+++ wml-1.6.7/wml_backend/p1_ipp/ipp.src	Fri Jan  1 22:32:15 1999
@@ -128,6 +128,7 @@
 
 %INLCUDES = ();
 $outbuf   = '';
+$blockfound = 0;
 
 sub setargs {
     my ($arg, $str) = @_;
@@ -245,6 +246,9 @@
     while ($l = <$in>) {
         $line++;
 
+        # Check if a comment block may be here
+        $blockfound = 1 if $l =~ m|/\*|;
+
         #
         #   Variable Interpolation
         #
@@ -428,8 +432,8 @@
 $outbuf = parseblock($outbuf, 
                      sub { return '' }, 0,             # just discard the stuff 
                      quotemeta('/*'), quotemeta('*/'), # the delimiters
-                     0, 1, '"', "\\", '"');            # the escapes, etc.
-
+                     0, 1, '"', "\\", '"')             # the escapes, etc.
+if $blockfound;
 
 #
 #  create output file
################## EOF  wml-ipp.patch ##############################

   Denis

--
D. Barbier
http://imacs.polytechnique.fr

______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com