Date: Thu, 09 Oct 2008 12:54:30 +0200 From: Ivan Voras <ivoras@freebsd.org> To: freebsd-questions@freebsd.org Subject: Re: performance problem in regex Message-ID: <gckns3$qg8$1@ger.gmane.org> In-Reply-To: <11642644.240911223546807054.JavaMail.defaultUser@defaultHost> References: <11642644.240911223546807054.JavaMail.defaultUser@defaultHost>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig871A72B4205B9525B4F27B27 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable fulvio_esposito1981@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.ne= t] use=20 > to recognize level 7 internet protocol. For example, with the skypeout = pattern,=20 > 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 count= ing 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. --------------enig871A72B4205B9525B4F27B27 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFI7eLmldnAQVacBcgRAnb7AKDtdfCVek1yordqg71AT2OPbqcmvwCgohMO UetHodOvDk6zOLMlmjTtFnY= =F+eH -----END PGP SIGNATURE----- --------------enig871A72B4205B9525B4F27B27--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?gckns3$qg8$1>