make re.finditer run faster...
Posted on 2004-11-29
Does anyone have any speed improvements to contribute on this code?
The input is email body firewall logs, so there can be many matches in one email.
regexppattern = compiled regexp code
matchlist = regexppattern.finditer(body)
(begin,end) = (0,0)
for m in matchlist:
(begin,end) = match2.span()
match = regexppattern.match(body,begin,end)
if match.group('ip') in foundstrings:
if len(foundstrings[match.group('ip')].log) > 5:
The code simply takes too long to execute if i send 600+ fwlog mails to it.
The code should take height for the possibilty for several ip's in one body.