httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: httpd-2.0/modules/filters mod_include.c
Date Wed, 26 Dec 2001 12:07:55 GMT
brianp      01/12/26 04:07:55

  Modified:    .        CHANGES
               modules/filters mod_include.c
  Log:
  Rearranged the code in mod_include's BNDM string-search function
  for faster execution.
  
  This new code short-circuits out of the inner scanning loop
  after a single comparison when it hits a character not in the
  "<!--#" pattern.  Compared to the previous code, this version
  does more work for characters in the pattern and less work for
  characters not in the pattern.  In practice, the net result
  seems to be a speedup for typical shtml files, where characters
  in the pattern are less common than characters not in the pattern.
  
  Revision  Changes    Path
  1.486     +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.485
  retrieving revision 1.486
  diff -u -r1.485 -r1.486
  --- CHANGES	2001/12/26 10:02:20	1.485
  +++ CHANGES	2001/12/26 12:07:55	1.486
  @@ -1,4 +1,7 @@
   Changes with Apache 2.0.30-dev
  +  *) More performance tweaks to the BNDM string-search algorithm
  +     used to find "<!--#" tokens in mod_include [Brian Pane]
  +
     *) Miscellaneous small performance fixes: optimized away various
        string copy operations and removed large temp buffers from
        the stack [Brian Pane]
  
  
  
  1.171     +8 -3      httpd-2.0/modules/filters/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
  retrieving revision 1.170
  retrieving revision 1.171
  diff -u -r1.170 -r1.171
  --- mod_include.c	2001/12/16 08:58:14	1.170
  +++ mod_include.c	2001/12/26 12:07:55	1.171
  @@ -261,7 +261,7 @@
       he = h + hl;
   
       T = t->T;
  -    x = t->x << 1;
  +    x = t->x;
   
       pi = h - 1; /* pi: p initial */
       p = pi + nl; /* compare window right to left. point to the first char */
  @@ -270,14 +270,19 @@
           skip = p;
           d = x;
           do {
  -            d = (d >> 1) & T[(unsigned char) *p--];
  +            d &= T[(unsigned char) *p--];
  +            if (!d) {
  +                break;
  +            }
               if ((d & 1)) {
                   if (p != pi)
                       skip = p;
                   else
                       return p - h + 1;
               }
  -        } while (d > 1);
  +            d >>= 1;
  +        } while (d);
  +
           pi = skip;
           p = pi + nl;
       }
  
  
  

Mime
View raw message