From owner-freebsd-questions Fri Mar 29 9:27: 4 2002 Delivered-To: freebsd-questions@freebsd.org Received: from icc.cgu.chel.su (gw.csu.ru [195.54.14.5]) by hub.freebsd.org (Postfix) with ESMTP id EF14A37B422; Fri, 29 Mar 2002 09:26:47 -0800 (PST) Received: from mail.cgu.chel.su (mail.cgu.chel.su [195.54.14.68]) by icc.cgu.chel.su (8.11.6/8.11.6) with ESMTP id g2THQgt41112 (using TLSv1/SSLv3 with cipher EDH-RSA-DES-CBC3-SHA (168 bits) verified NO); Fri, 29 Mar 2002 22:26:42 +0500 (YEKT) (envelope-from ilia@cgu.chel.su) Received: (from uucp@localhost) by mail.cgu.chel.su (8.11.6/8.11.2) with UUCP id g2THQgM37570; Fri, 29 Mar 2002 22:26:42 +0500 (YEKT) (envelope-from ilia@cgu.chel.su) Received: from localhost (localhost.cgu.chel.su [127.0.0.1]) by jane.poka.net (8.11.6/8.11.1) with ESMTP id g2TGL4e01119; Fri, 29 Mar 2002 21:21:04 +0500 (YEKT) (envelope-from ilia@cgu.chel.su) Date: Fri, 29 Mar 2002 21:21:03 +0500 (YEKT) From: Ilia Chipitsine X-Sender: ilia@jane.poka.net To: questions@FreeBSD.ORG Cc: hackers@FreeBSD.ORG Subject: perfomance and regular expressions Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=koi8-r Content-Transfer-Encoding: 8BIT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Dear Sirs, I'm currently implementing a program which will run thousands and thousands times. It uses regular expressions. something really simple, like regex_t re; regcomp(&re,"^[0123456789abcdefghijklmnopqrstuvwxyz]{1,8}$", REG_EXTENDED+REG_ICASE); return(!regexec(&re,name,0,0,0)); so, questions are: 1) is it faster to "compile" regex once and load it from file every time program starts ? 2) how to store in a file data of type "regex_t" ?? Regards, (Наилучшие пожелания) Ilia Chipitsine (Илья Шипицин) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message