Just a thought

Rick Cooper rcooper at DWFORD.COM
Sat Mar 6 16:14:25 GMT 2004


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



More information about the MailScanner mailing list