From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Info-dir-remove-duplicates is slow Date: Mon, 08 Aug 2005 00:14:01 +0200 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1123453595 14830 80.91.229.2 (7 Aug 2005 22:26:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 7 Aug 2005 22:26:35 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 08 00:26:26 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E1tb8-00025D-08 for ged-emacs-devel@m.gmane.org; Mon, 08 Aug 2005 00:26:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E1te1-0003X1-An for ged-emacs-devel@m.gmane.org; Sun, 07 Aug 2005 18:29:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E1tdA-0003QB-KY for emacs-devel@gnu.org; Sun, 07 Aug 2005 18:28:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E1td1-0003Mz-8A for emacs-devel@gnu.org; Sun, 07 Aug 2005 18:28:23 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E1td1-0003Mb-1r for emacs-devel@gnu.org; Sun, 07 Aug 2005 18:28:23 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1E1tjb-000285-54 for emacs-devel@gnu.org; Sun, 07 Aug 2005 18:35:11 -0400 Original-Received: from root by ciao.gmane.org with local (Exim 4.43) id 1E1tV3-0001g7-NZ for emacs-devel@gnu.org; Mon, 08 Aug 2005 00:20:09 +0200 Original-Received: from dialin-226111.rol.raiffeisen.net ([195.254.226.111]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 08 Aug 2005 00:20:09 +0200 Original-Received: from e9626484 by dialin-226111.rol.raiffeisen.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 08 Aug 2005 00:20:09 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 41 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: dialin-226111.rol.raiffeisen.net User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:4wP7FhUwYrsU2k/hpEw49jJMDTc= 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:41670 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:41670 With the current CVS Emacs, info is quite slow. Calling (info) takes about 1.7 seconds here. I've already set Info-fontify-maximum-menu-size to 30000 and so fontification is disabled. (With fontification it takes 2.4 seconds.) With the patch below it takes about only 0.3 seconds. The modification is quite small: it replaces the expensive call to member-ignore-case with a call to member and only keeps downcased strings around. Helmut. --- info.el 07 Aug 2005 16:06:08 +0200 1.438 +++ info.el 07 Aug 2005 23:51:10 +0200 @@ -1152,17 +1152,17 @@ (defun Info-dir-remove-duplicates () (delete-region (1- (point)) (point)))) ;; Now remove duplicate entries under the same heading. - (let ((seen nil) + (let ((seen '()) (limit (point))) (goto-char start) (while (re-search-forward "^* \\([^:\n]+:\\(:\\|[^.\n]+\\).\\)" limit 'move) - (let ((x (match-string 1))) - (if (member-ignore-case x seen) + (let ((key (downcase (match-string 1)))) + (if (member key seen) (delete-region (match-beginning 0) (progn (re-search-forward "^[^ \t]" nil t) (match-beginning 0))) - (push x seen)))))))))) + (push key seen)))))))))) ;; Note that on entry to this function the current-buffer must be the ;; *info* buffer; not the info tags buffer.