From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.bugs Subject: bug#4511: 23.1; flyspell-mode slow editing near end of big html file Date: Tue, 22 Sep 2009 08:24:38 +1000 Message-ID: <87ws3sgcm1.fsf@blah.blah> Reply-To: Kevin Ryde , 4511@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1253573246 25012 80.91.229.12 (21 Sep 2009 22:47:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Sep 2009 22:47:26 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 22 00:47:19 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MprfC-0001Rz-BO for geb-bug-gnu-emacs@m.gmane.org; Tue, 22 Sep 2009 00:47:18 +0200 Original-Received: from localhost ([127.0.0.1]:43484 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MprfB-0002hZ-RM for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Sep 2009 18:47:17 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mprf6-0002ed-Uf for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2009 18:47:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mprf1-0002eA-EX for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2009 18:47:11 -0400 Original-Received: from [199.232.76.173] (port=53232 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mprf1-0002e7-6Q for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2009 18:47:07 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:52673) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mprf0-0002n4-HU for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2009 18:47:06 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8LMl3Rm005357; Mon, 21 Sep 2009 15:47:04 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n8LMZBIT003690; Mon, 21 Sep 2009 15:35:11 -0700 Resent-Date: Mon, 21 Sep 2009 15:35:11 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Kevin Ryde Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Mon, 21 Sep 2009 22:35:10 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 4511 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.12535719632485 (code B ref -1); Mon, 21 Sep 2009 22:35:10 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 21 Sep 2009 22:26:03 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8LMQ0SH002482 for ; Mon, 21 Sep 2009 15:26:01 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MprKZ-0001mn-Op for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2009 18:25:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MprKS-0001ma-OJ for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2009 18:25:59 -0400 Original-Received: from [199.232.76.173] (port=55946 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MprKS-0001mX-Jm for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2009 18:25:52 -0400 Original-Received: from mailout2-10.pacific.net.au ([125.255.80.137]:40099 helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MprKR-0007mB-4Z for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2009 18:25:52 -0400 Original-Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.2.162]) by mailout2.pacific.net.au (Postfix) with ESMTP id 1371118DF9D for ; Tue, 22 Sep 2009 08:25:45 +1000 (EST) Original-Received: from blah.blah (ppp2A26.dyn.pacific.net.au [61.8.42.38]) by mailproxy1.pacific.net.au (Postfix) with ESMTP id C13778C0F for ; Tue, 22 Sep 2009 08:25:39 +1000 (EST) Original-Received: from gg by blah.blah with local (Exim 4.69) (envelope-from ) id 1MprJG-00019T-LT for bug-gnu-emacs@gnu.org; Tue, 22 Sep 2009 08:24:38 +1000 User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Mon, 21 Sep 2009 18:47:11 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:31331 Archived-At: --=-=-= When flyspell-mode is enabled in a big html file, and point is somewhere near the end of the buffer, typing text or moving point with C-f and C-b become sluggish, to the point of being nearly unusable. (This is a regression from emacs 22, where flyspell-mode was fine on such files.) I expect "big file" is relative to cpu speed, but 300 kbytes is bad on my slow pc (not an outrageously huge file). To reproduce try this of about 600 kbytes, (progn (switch-to-buffer "foo") (dotimes (i 50000) (insert (format "

abc def\n" i))) (html-mode) (flyspell-mode)) It takes a few seconds to create the buffer, but of course that's not the bug. The bad bit is if you move point around with C-f / C-b near the end of the buffer, or type some plain text there outside of a , where it's sluggish between keystrokes. (Try upping the 50000 on a fast cpu if necessary.) I track the slowness to where `sgml-mode-flyspell-verify' does (looking-back "<[^>\n]*") I take it this func is asking whether point is within a or not. Does that regexp end up asking re-search-backward to consider every "<" in the buffer or something, before deciding no match is possible? I find it hugely faster to do an old fashioned skip-chars-backward as below -- assuming I'm not mistaken that the "\n" in the existing `looking-back' is supposed mean examining no more than the current line. 2009-09-21 Kevin Ryde * textmodes/flyspell.el (sgml-mode-flyspell-verify): Use skip-chars-backward instead of looking-back, to avoid a very slow regexp match when far into a big buffer with a lots of "<" chars. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=flyspell.el.sgml-verify.diff --- flyspell.el.~1.146.~ 2009-09-18 08:23:13.000000000 +1000 +++ flyspell.el 2009-09-21 16:36:12.000000000 +1000 @@ -363,7 +363,9 @@ "Function used for `flyspell-generic-check-word-predicate' in SGML mode." (not (save-excursion (or (looking-at "[^<\n]*>") - (ispell-looking-back "<[^>\n]*") + (save-excursion + (skip-chars-backward "^<>\n") ;; \n only look at current line + (not (equal ?< (char-before)))) ;; "<" if in a tag (and (looking-at "[^&\n]*;") (ispell-looking-back "&[^;\n]*")))))) --=-=-= In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5) of 2009-08-03 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 --=-=-=--