From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: latexenc-find-file-coding-system is slow. Date: Fri, 29 Apr 2005 12:13:56 -0400 Message-ID: References: <87ekcxrbb8.fsf@arnested.dk> <87u0lpye89.fsf_-_@xs4all.nl> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1114971141 2042 80.91.229.2 (1 May 2005 18:12:21 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 1 May 2005 18:12:21 +0000 (UTC) Cc: Thien-Thi Nguyen , Arne =?iso-8859-1?Q?J=F8rgensen?= , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 01 20:12:18 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DSIud-0006Q7-Fh for ged-emacs-devel@m.gmane.org; Sun, 01 May 2005 20:11:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DSJ1N-0006j0-II for ged-emacs-devel@m.gmane.org; Sun, 01 May 2005 14:18:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DSI91-0003Vw-Mo for emacs-devel@gnu.org; Sun, 01 May 2005 13:22:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DSI8o-0003RO-II for emacs-devel@gnu.org; Sun, 01 May 2005 13:22:02 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DSI8l-0003JW-LQ for emacs-devel@gnu.org; Sun, 01 May 2005 13:22:00 -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 1DSIAO-0006H2-G7; Sun, 01 May 2005 13:23:40 -0400 Original-Received: from [206.47.199.166] (helo=simmts8-srv.bellnexxia.net) by mx20.gnu.org with esmtp (Exim 4.34) id 1DRYBS-00028i-DR; Fri, 29 Apr 2005 12:17:42 -0400 Original-Received: from empanada.home ([67.71.118.90]) by simmts8-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050429161357.BZKL1623.simmts8-srv.bellnexxia.net@empanada.home>; Fri, 29 Apr 2005 12:13:57 -0400 Original-Received: by empanada.home (Postfix, from userid 502) id 2BBD1544448; Fri, 29 Apr 2005 12:13:57 -0400 (EDT) Original-To: Lute Kamstra In-Reply-To: <87u0lpye89.fsf_-_@xs4all.nl> (Lute Kamstra's message of "Fri, 29 Apr 2005 14:11:34 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) 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:36542 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36542 > re-search-forward("^[^%$]*\\usepackage\\[\\(.*\\)\\]{inputenc}" nil t) ^^ shouldn't this be \\\\ ? > I guess the re-searching in latexenc-find-file-coding-system needs to > be improved. I see two obvious ways to speed it up: - 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". - don't search through the whole buffer but only though the first part (10K or so) of it. > Since this change, opening a 117k .texi file takes seconds. It used The filename regexp was broken, I've adjusted it so it doesn't get triggered for .texi files. Stefan