From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Agustin Martin Newsgroups: gmane.emacs.bugs Subject: bug#16800: 24.3; flyspell works slow on very short words at the end of big file Date: Wed, 26 Feb 2014 21:32:02 +0100 Message-ID: <20140226203202.GA23749@agmartin.aq.upm.es> References: <20140222124413.GA4971@openwall.com> <83vbw72t05.fsf@gnu.org> <20140222160217.GA15616@openwall.com> <83ios72j8b.fsf@gnu.org> <20140222185511.GA23643@openwall.com> <838ut23lo9.fsf@gnu.org> <20140223195659.GA23581@openwall.com> <20140223230251.GA30257@openwall.com> <20140224160317.GA2475@openwall.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1393446802 21718 80.91.229.3 (26 Feb 2014 20:33:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Feb 2014 20:33:22 +0000 (UTC) To: Aleksey Cherepanov , 16800@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 26 21:33:29 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 1WIlAQ-0002UZ-B0 for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Feb 2014 21:33:22 +0100 Original-Received: from localhost ([::1]:43121 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIlAP-0005aZ-U1 for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Feb 2014 15:33:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIlAF-0005Ef-9k for bug-gnu-emacs@gnu.org; Wed, 26 Feb 2014 15:33:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WIlA7-0002NI-AR for bug-gnu-emacs@gnu.org; Wed, 26 Feb 2014 15:33:11 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40684) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIlA7-0002NE-7B for bug-gnu-emacs@gnu.org; Wed, 26 Feb 2014 15:33:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WIlA6-0005Ne-Uy for bug-gnu-emacs@gnu.org; Wed, 26 Feb 2014 15:33:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Agustin Martin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Feb 2014 20:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16800 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16800-submit@debbugs.gnu.org id=B16800.139344672720575 (code B ref 16800); Wed, 26 Feb 2014 20:33:02 +0000 Original-Received: (at 16800) by debbugs.gnu.org; 26 Feb 2014 20:32:07 +0000 Original-Received: from localhost ([127.0.0.1]:41861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WIl9D-0005Ln-9g for submit@debbugs.gnu.org; Wed, 26 Feb 2014 15:32:07 -0500 Original-Received: from fibonacci.ccupm.upm.es ([138.100.198.70]:33477) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WIl9A-0005La-NC for 16800@debbugs.gnu.org; Wed, 26 Feb 2014 15:32:05 -0500 Original-Received: from agmartin.aq.upm.es (Agmartin.aq.upm.es [138.100.41.131]) by smtp.upm.es (8.14.3/8.14.3/fibonacci-001) with ESMTP id s1QKW2mA016894; Wed, 26 Feb 2014 21:32:03 +0100 Original-Received: by agmartin.aq.upm.es (Postfix, from userid 1000) id DD177407A6; Wed, 26 Feb 2014 21:32:02 +0100 (CET) Content-Disposition: inline In-Reply-To: <20140224160317.GA2475@openwall.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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:86296 Archived-At: On Mon, Feb 24, 2014 at 08:03:17PM +0400, Aleksey Cherepanov wrote: > I played with different (maybe wrong) implementations of > flyspell-word-search-backward and measured time against t.txt > (produced by the one-liner). All implementations are attached. [ ... Tons of extensive and impressive debugging ... ] > We could avoid capturing at all. And it works faster as shown by 4 > last functions. Hi, Thanks a lot for the extensive debugging and for all the suggestions. I have been playing with something based in your last function, but trying to get something more compact, see below current status ;; ----------------------------------- (defun my-test-concat-up-goto-notcap-nobob-bobp-if (word bound &optional ignore-case) (save-excursion (let* ((r '()) (inhibit-point-motion-hooks t) (flyspell-not-casechars (flyspell-get-not-casechars)) (word-re (concat flyspell-not-casechars (regexp-quote word) flyspell-not-casechars)) p) (while (and (not r) (setq p (if (re-search-backward word-re bound t) (progn (forward-char) (point)) ;; Check if word is at bob (goto-char (point-min)) (search-forward word (length word) t)))) (let ((lw (flyspell-get-word))) (if (and (consp lw) (if ignore-case (string-equal (downcase (car lw)) (downcase word)) (string-equal (car lw) word))) (setq r p) (goto-char p)))) r))) ;; ----------------------------------- I did some efficiency test and it seemed similar to those of your efficient functions. Need to check further for corner cases, bugs, etc ... Big thanks! -- Agustin