From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nicolas Richard Newsgroups: gmane.emacs.bugs Subject: bug#18013: 24.3.92; looking-back "[^\n]" taking a lot of time in large buffers (was: Infloop in re_search_2) Date: Mon, 14 Jul 2014 13:12:34 +0200 Message-ID: <878unw9ot9.fsf_-_@geodiff-mac3.ulb.ac.be> References: <87oaws9sp2.fsf@geodiff-mac3.ulb.ac.be> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1405336295 23994 80.91.229.3 (14 Jul 2014 11:11:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Jul 2014 11:11:35 +0000 (UTC) Cc: Nicolas Richard , 18013@debbugs.gnu.org To: Andreas Schwab Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 14 13:11:23 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X6eAB-0001fI-6s for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Jul 2014 13:11:19 +0200 Original-Received: from localhost ([::1]:56471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6eAA-0005Xl-M2 for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Jul 2014 07:11:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33327) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6eA1-0005P4-6t for bug-gnu-emacs@gnu.org; Mon, 14 Jul 2014 07:11:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X6e9v-0007EO-99 for bug-gnu-emacs@gnu.org; Mon, 14 Jul 2014 07:11:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6e9u-0007ED-VE for bug-gnu-emacs@gnu.org; Mon, 14 Jul 2014 07:11:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X6e9u-0005ts-E2 for bug-gnu-emacs@gnu.org; Mon, 14 Jul 2014 07:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nicolas Richard Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Jul 2014 11:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18013 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18013-submit@debbugs.gnu.org id=B18013.140533625722670 (code B ref 18013); Mon, 14 Jul 2014 11:11:02 +0000 Original-Received: (at 18013) by debbugs.gnu.org; 14 Jul 2014 11:10:57 +0000 Original-Received: from localhost ([127.0.0.1]:54241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X6e9l-0005tW-Ct for submit@debbugs.gnu.org; Mon, 14 Jul 2014 07:10:57 -0400 Original-Received: from mxin.ulb.ac.be ([164.15.128.112]:19048) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X6e9f-0005tF-JP for 18013@debbugs.gnu.org; Mon, 14 Jul 2014 07:10:51 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AooFALS5w1OkD4Xx/2dsb2JhbABZhyupJAEBAQEBAQacbQGBLnWEBAEEASNWBQsLGgIfBwICEARJE4gtAQMJCK9vgXKNZQGHfxeBLIRPgiKFAYF6MweCd4FMBYRsBZQjiHSEXYIwhheCAoFEOw Original-Received: from mathsrv4.ulb.ac.be (HELO geodiff-mac3.ulb.ac.be) ([164.15.133.241]) by smtp.ulb.ac.be with ESMTP; 14 Jul 2014 13:10:46 +0200 In-Reply-To: (Andreas Schwab's message of "Mon, 14 Jul 2014 12:06:55 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91530 Archived-At: Andreas Schwab writes: > Nicolas Richard writes: > >> I'll admit that (looking-back "[^\n]") is not exactly the canonical way >> to test for (not (bolp)), but should it make an infloop ? I can't >> reproduce though. > > I don't think it infloops, it just takes a very long time. Since this > is running in a process filter interrupts are disabled, so you have to > be extra careful with what you do here. It seems you were totally right, thanks ! Here's a repro test case : # pick up a big file or make one : $ yes | dd bs=3D1MB iflag=3Dfullblock count=3D50 > foobartest=20 50+0=C2=A0enregistrements lus 50+0=C2=A0enregistrements =C3=A9crits 50000000=C2=A0octets (50 MB) copi=C3=A9s, 0,853576=C2=A0s, 58,6 MB/s # open it in an emacs buffer and try looking-back : $ time emacs --batch -Q --eval '(with-temp-buffer (insert-file-contents "fo= obartest") (goto-char (point-max)) (princ "Looking back...") (looking-back = "[^\n]") (princ "done!") (terpri))' "Looking back..." "done!" real 0m8.577s user 0m8.541s sys 0m0.047s As you see it takes more than 8 seconds on my system, most of that time is spent looking-back (inserting the file is quick). (looking-back "[^\n]") is bad code, so I totally deserve this. Still, is it possible to make the search smarter when the match is supposed to be "anchored" at point ? Otherwise let's just close this bug. --=20 Nico.