Just a thought

Julian Field mailscanner at ecs.soton.ac.uk
Sat Mar 6 16:54:22 GMT 2004


I thought it only made a difference for regexps that include variables. I
had hoped that regexps including only static texts would only be compiled
once. Anything in the Perl docs to back either of our views?

At 16:14 06/03/2004, you wrote:
>Julian,
>
>In reference to that "escape any regex characters" thing I
>submitted that you added in the last release, it occurred to me
>that while that may be more efficient that multiple =~ lines it
>still has to be compiled for each line in the report you are
>reading and, given the speed concerns already present,  it would
>be much faster if it were changed to:
>
>s/([\(\)\[\]\.\?\*\+\^"'@<>:])/\\$1/go;
>
>  or better yet add:
>my $ea = qr/([\(\)\[\]\.\?\*\+\^"'@<>:])/;
>
>above the while( defined($line (or add it as global to be used in
>both places)
>
>and change the expression to:
>s/$ea/\\$1/g;
>
>Might look into compiling other static expressions used in
>looping functions to get a speed increase, and perhaps compiling
>globally available expressions to be used in recursive functions
>or for expressions that are repeated over and over within various
>places in the various modules.. Just a thought as it looks like a
>lot of the mime stuff use static regular expressions within
>looping structures and that should drop the overhead of compiling
>the expression through every iteration (if you are looking for
>some tweaks).
>
>--
>Rick Cooper

--
Julian Field
www.MailScanner.info
Professional Support Services at www.MailScanner.biz
MailScanner thanks transtec Computers for their support
PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654



More information about the MailScanner mailing list