From owner-freebsd-questions@FreeBSD.ORG Thu Oct 9 10:54:05 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F2B8106568B for ; Thu, 9 Oct 2008 10:54:05 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id 075098FC28 for ; Thu, 9 Oct 2008 10:54:04 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Knt9f-000334-Ra for freebsd-questions@freebsd.org; Thu, 09 Oct 2008 10:54:03 +0000 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Oct 2008 10:54:03 +0000 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Oct 2008 10:54:03 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-questions@freebsd.org From: Ivan Voras Date: Thu, 09 Oct 2008 12:54:30 +0200 Lines: 66 Message-ID: References: <11642644.240911223546807054.JavaMail.defaultUser@defaultHost> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig871A72B4205B9525B4F27B27" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Thunderbird 2.0.0.17 (X11/20080925) In-Reply-To: <11642644.240911223546807054.JavaMail.defaultUser@defaultHost> X-Enigmail-Version: 0.95.0 Sender: news Subject: Re: performance problem in regex X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2008 10:54:05 -0000 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--