unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Helmut Eller <e9626484@stud3.tuwien.ac.at>
Subject: Info-dir-remove-duplicates is slow
Date: Mon, 08 Aug 2005 00:14:01 +0200	[thread overview]
Message-ID: <m2ek95l7iu.fsf@stud3.tuwien.ac.at> (raw)

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.

             reply	other threads:[~2005-08-07 22:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-07 22:14 Helmut Eller [this message]
2005-08-08  0:29 ` Info-dir-remove-duplicates is slow Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2ek95l7iu.fsf@stud3.tuwien.ac.at \
    --to=e9626484@stud3.tuwien.ac.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).