performance problem in regex
Ivan Voras
ivoras at freebsd.org
Thu Oct 9 10:54:05 UTC 2008
fulvio_esposito1981 at libero.it wrote:
> Hi all,
> I've got some performance hit using regex in libc on freebsd 6.3. I've
> done some test whit the patterns that l7-filter [http://l7-filter.sf.net] use
> to recognize level 7 internet protocol. For example, with the skypeout pattern,
> regexec() takes more tha 0.1 sec to do its work. Is this a know problem?
It's known that regex(3) is slow for some cases. See
http://www.freebsd.org/cgi/man.cgi?regex , especially the paragraphs
"""
The regexec() function performance is poor. This will improve with
later
releases. The nmatch argument exceeding 0 is expensive; nmatch
exceeding
1 is worse. The regexec() function is largely insensitive to RE
complex-
ity except that back references are massively expensive. RE length
does
matter; in particular, there is a strong speed bonus for keeping RE
length under about 30 characters, with most special characters counting
roughly double.
The regcomp() function implements bounded repetitions by macro
expansion,
which is costly in time and space if counts are large or bounded
repeti-
tions are nested. An RE like, say,
`((((a{1,100}){1,100}){1,100}){1,100}){1,100}' will (eventually) run
almost any existing machine out of swap space.
"""
Someone with more experience in the regex(3) implementation should see
if the pattern:
http://l7-filter.sourceforge.net/layer7-protocols/protocols/skypeout.pat
Falls into these conditions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20081009/d302bd08/signature.pgp
More information about the freebsd-questions
mailing list