From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lute Kamstra Newsgroups: gmane.emacs.devel Subject: Re: latexenc-find-file-coding-system is slow. Date: Fri, 29 Apr 2005 19:19:29 +0200 Message-ID: <87d5sd4i1q.fsf@xs4all.nl> References: <87ekcxrbb8.fsf@arnested.dk> <87u0lpye89.fsf_-_@xs4all.nl> <877jil8rz5.fsf@arnested.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1114972875 8702 80.91.229.2 (1 May 2005 18:41:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 1 May 2005 18:41:15 +0000 (UTC) Cc: Thien-Thi Nguyen , Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 01 20:41:12 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DSJN7-00021K-BF for ged-emacs-devel@m.gmane.org; Sun, 01 May 2005 20:40:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DSJTr-0008Ho-Me for ged-emacs-devel@m.gmane.org; Sun, 01 May 2005 14:47:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DSIUI-0005Bt-O1 for emacs-devel@gnu.org; Sun, 01 May 2005 13:44:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DSIUC-00057k-In for emacs-devel@gnu.org; Sun, 01 May 2005 13:44:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DSINv-0001d3-De for emacs-devel@gnu.org; Sun, 01 May 2005 13:37:39 -0400 Original-Received: from [199.232.41.67] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_ARCFOUR_SHA:16) (Exim 4.34) id 1DSIEr-0007ub-Ua; Sun, 01 May 2005 13:28:18 -0400 Original-Received: from [194.109.24.34] (helo=smtp-vbr14.xs4all.nl) by mx20.gnu.org with esmtp (Exim 4.34) id 1DRZ9I-0001z5-96; Fri, 29 Apr 2005 13:19:32 -0400 Original-Received: from pijl (a80-127-67-124.adsl.xs4all.nl [80.127.67.124]) by smtp-vbr14.xs4all.nl (8.12.11/8.12.11) with ESMTP id j3THJU6a073742; Fri, 29 Apr 2005 19:19:30 +0200 (CEST) (envelope-from Lute.Kamstra@xs4all.nl) Original-Received: from lute by pijl with local (Exim 3.36 #1 (Debian)) id 1DRZ9F-0006J2-00; Fri, 29 Apr 2005 19:19:29 +0200 Original-To: Arne =?iso-8859-1?Q?J=F8rgensen?= In-Reply-To: <877jil8rz5.fsf@arnested.dk> (Arne =?iso-8859-1?Q?J=F8rgensen?= =?iso-8859-1?Q?'s?= message of "Fri, 29 Apr 2005 18:31:26 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Original-Lines: 31 X-Virus-Scanned: by XS4ALL Virus Scanner X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:36547 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36547 Arne J=F8rgensen writes: > Stefan Monnier writes: [...] >> - use (re-search-forward "\\\\usepackage\\[\\(.*\\)\\]{inputenc}") >> and once it matched, check if it's inside a comment. This should be >> *much* faster because of how the regexp-engine works (basically, >> it will backtrack much less). The search as it is coded now could very >> well fail with "regexp stack overflow". [...] > Lute Kamstra writes: [...] >> Another idea is to change the regexps and search only for >> \inputencoding{...} and \usepackage[...]{inputenc} at the start of a >> line. That's where they typically are. This will speed up the search >> dramatically. > > That would probably be an ok compromise (between what is actually > legal LaTeX and what is normally used). But the other approaches can > do the trick I would prefer to avoid this. You can avoid it by using Stefan's suggestion above. It is probably faster than my idea, but a bit more work to implement. Lute.