From unknown Thu Jun 19 14:21:49 2025 X-Loop: bug-gnu-emacs@gnu.org Subject: bug#5599: 23.1; compilation error regexp "watcom" slow on long lines Resent-From: Kevin Ryde Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Feb 2010 21:32:02 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: report 5599 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: To: 5599@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.126652870129509 (code B ref -1); Thu, 18 Feb 2010 21:32:02 +0000 Received: (at submit) by debbugs.gnu.org; 18 Feb 2010 21:31:41 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NiDyH-0007fu-03 for submit@debbugs.gnu.org; Thu, 18 Feb 2010 16:31:41 -0500 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NiDy0-0007fd-T3 for submit@debbugs.gnu.org; Thu, 18 Feb 2010 16:31:39 -0500 Received: from mail.gnu.org ([199.232.76.166]:60337 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NiDxw-0003kn-Rs for submit@debbugs.gnu.org; Thu, 18 Feb 2010 16:31:20 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NiDxu-0005Yh-SF for submit@debbugs.gnu.org; Thu, 18 Feb 2010 16:31:20 -0500 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on monty-python X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO,UNPARSEABLE_RELAY autolearn=ham version=3.1.0 Received: from lists.gnu.org ([199.232.76.165]:52711) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NiDxu-0005Yd-M9 for submit@debbugs.gnu.org; Thu, 18 Feb 2010 16:31:18 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NiDxu-0002QR-AC for bug-gnu-emacs@gnu.org; Thu, 18 Feb 2010 16:31:18 -0500 Received: from [140.186.70.92] (port=46037 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NiDxp-0002Pg-OB for bug-gnu-emacs@gnu.org; Thu, 18 Feb 2010 16:31:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NiDxo-0005sw-26 for bug-gnu-emacs@gnu.org; Thu, 18 Feb 2010 16:31:13 -0500 Received: from mailout1-14.pacific.net.au ([125.255.80.133]:37784 helo=mailout1.pacific.net.au) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NiDxn-0005sf-G6 for bug-gnu-emacs@gnu.org; Thu, 18 Feb 2010 16:31:12 -0500 Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout1.pacific.net.au (Postfix) with ESMTP id 977C152C77C for ; Fri, 19 Feb 2010 08:31:06 +1100 (EST) Received: from blah.blah (ppp2CF2.dyn.pacific.net.au [61.8.44.242]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id 9B9DE2740F for ; Fri, 19 Feb 2010 08:31:05 +1100 (EST) Received: from gg by blah.blah with local (Exim 4.71) (envelope-from ) id 1NiDxb-0002gY-N2 for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2010 08:30:59 +1100 From: Kevin Ryde Date: Fri, 19 Feb 2010 08:30:58 +1100 Message-ID: <87pr42qlil.fsf@blah.blah> User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.4 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) --=-=-= If a compilation-mode buffer has a very long line, the `watcom' error regexp pattern is very slow at not matching. For example the foo.el below takes my old pc about 20 seconds to match nothing. The line in foo.el is 10,000 chars long, which might seem improbable, but in fact arises very easily from a "make" echoing a list of filenames from a distribution, eg. 200 filenames averaging 50 chars each including paths. (I've got one dist where the make spits 12,000 char lines, and another repeated 1500 char lines ...). I suppose the optional drive letter part of the pattern makes it backtrack to every character. I wonder if it could anchor to the start of the line to restrict that. (The alternative could be to loosen what's considered a filename there.) 2010-02-18 Kevin Ryde * progmodes/compile.el (compilation-error-regexp-alist-alist): In `watcom' add "^" for filename only at start of line. Avoids slowness backtracking to every char of a long line, O(N^2) in the length, eg. 20 seconds to fail to match a 10,000 char line. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=compile.el.watcom.diff --- compile.el.~1.504.~ 2009-11-26 10:28:08.000000000 +1100 +++ compile.el 2010-02-18 19:39:05.000000000 +1100 @@ -350,7 +350,7 @@ "^\\([^, \n\t]+\\), line \\([0-9]+\\), char \\([0-9]+\\)[:., \(-]" 1 2 3) (watcom - "\\(\\(?:[a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)): ?\ + "^\\(\\(?:[a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)): ?\ \\(?:\\(Error! E[0-9]+\\)\\|\\(Warning! W[0-9]+\\)\\):" 1 2 nil (4)) --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline; filename=foo.el Content-Transfer-Encoding: quoted-printable (progn (switch-to-buffer "x") (erase-buffer) (dotimes (i 1000) (insert "xfoo barxx")) (insert "\n") =20=20 (require 'compile) (setq compilation-error-regexp-alist '(watcom)) (let ((beg (float-time))) (compilation-mode) (message "took %.2f" (- (float-time) beg)))) --=-=-= In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5) of 2009-09-14 on raven, modified by Debian configured using `configure '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_AU value of $XMODIFIERS: nil locale-coding-system: iso-latin-1-unix default-enable-multibyte-characters: t --=-=-=-- From unknown Thu Jun 19 14:21:49 2025 X-Loop: bug-gnu-emacs@gnu.org Subject: bug#5599: 23.1; compilation error regexp "watcom" slow on long lines References: <87pr42qlil.fsf@blah.blah> In-Reply-To: <87pr42qlil.fsf@blah.blah> Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Feb 2010 13:55:02 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: followup 5599 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: To: Kevin Ryde Cc: 5599@debbugs.gnu.org Received: via spool by 5599-submit@debbugs.gnu.org id=B5599.126667409014525 (code B ref 5599); Sat, 20 Feb 2010 13:55:02 +0000 Received: (at 5599) by debbugs.gnu.org; 20 Feb 2010 13:54:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NipnG-0003mE-EW for submit@debbugs.gnu.org; Sat, 20 Feb 2010 08:54:50 -0500 Received: from pantheon-po33.its.yale.edu ([130.132.50.94]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NipnC-0003m4-GE for 5599@debbugs.gnu.org; Sat, 20 Feb 2010 08:54:48 -0500 Received: from furry (adsl-99-96-75-7.dsl.wlfrct.sbcglobal.net [99.96.75.7]) (authenticated bits=0) by pantheon-po33.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o1KDseqE008083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 20 Feb 2010 08:54:41 -0500 Received: by furry (Postfix, from userid 1000) id 74F4FC05D; Sat, 20 Feb 2010 08:54:39 -0500 (EST) From: Chong Yidong Date: Sat, 20 Feb 2010 08:54:39 -0500 Message-ID: <87vddsypuo.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -1.1 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > If a compilation-mode buffer has a very long line, the `watcom' error > regexp pattern is very slow at not matching. For example the foo.el > below takes my old pc about 20 seconds to match nothing. > > I suppose the optional drive letter part of the pattern makes it > backtrack to every character. I wonder if it could anchor to the start > of the line to restrict that. Yes, I think that's fine. I've checked in your patch, with a small modification to allow whitespace in front of the drive letter part. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 20 08:54:57 2010 Received: (at control) by debbugs.gnu.org; 20 Feb 2010 13:54:57 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NipnN-0003mX-LL for submit@debbugs.gnu.org; Sat, 20 Feb 2010 08:54:57 -0500 Received: from pantheon-po33.its.yale.edu ([130.132.50.94]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NipnM-0003mK-B5 for control@debbugs.gnu.org; Sat, 20 Feb 2010 08:54:56 -0500 Received: from furry (adsl-99-96-75-7.dsl.wlfrct.sbcglobal.net [99.96.75.7]) (authenticated bits=0) by pantheon-po33.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o1KDspIn009010 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sat, 20 Feb 2010 08:54:51 -0500 Received: by furry (Postfix, from userid 1000) id F04F1C05D; Sat, 20 Feb 2010 08:54:50 -0500 (EST) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 5599 Date: Sat, 20 Feb 2010 08:54:50 -0500 Message-ID: <87sk8wypud.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -2.2 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.4 (--) close 5599 thanks