Jeff Orrok writes:
I have a fairly involved suite of procmailrc's for a client that processes
all of the email leads that he receives from visitors to various websites.
Everything seems to be working ok, but today when I was testing in preparation
for upgrading, I was horrified to discover that it was taking almost 8 minutes
to process 8 messages in my test file. I'm not sure when it started doing
this, since I proceeded to regress my changes, and even pulled his current copy
over for comparison, and every version seems to be doing the same thing.
I would suspect a regular expression.
This sort of thing is one of those "watch for this" problems in Perl. It
isn't just the regular expression, but the particular data it is
processing. If regular expressions get almost to the end and fail they have
to backtrack and try again. If that fails too, then they have to backtrack
some more, etc. etc. With the right combination of regular expression and
input, a regex which doesn't look too bad to a human can take "forever",
for most values of "forever" on current-issue hardware. Watch for regexes
comprised of "many" sequential wildcard matches, especially when they start
with the same letter. The classic example from _Programming Perl_ is
matching
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"
with
a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*[b]
Which succeeds quickly but will take a really long time to fail if you
remove the "b" from the end of the string and run it against the same match
expression.
HTH.
--
Fred Morris
m3047(_at_)inwa(_dot_)net
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail