unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Info-dir-remove-duplicates is slow
@ 2005-08-07 22:14 Helmut Eller
  2005-08-08  0:29 ` Thien-Thi Nguyen
  0 siblings, 1 reply; 2+ messages in thread
From: Helmut Eller @ 2005-08-07 22:14 UTC (permalink / 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Info-dir-remove-duplicates is slow
  2005-08-07 22:14 Info-dir-remove-duplicates is slow Helmut Eller
@ 2005-08-08  0:29 ` Thien-Thi Nguyen
  0 siblings, 0 replies; 2+ messages in thread
From: Thien-Thi Nguyen @ 2005-08-08  0:29 UTC (permalink / raw
  Cc: emacs-devel

Helmut Eller <e9626484@stud3.tuwien.ac.at> writes:

> 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.

thanks for the idea.  i have installed a change in
`Info-dir-remove-duplicates' along those lines, the
difference being preservation of the variable name
`x'.  btw, if you had sent such a diff (and in "diff
-c" format), i (or someone else quicker) would have
applied it directly and recorded your name in the
ChangeLog file as the author of the change.

thi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-08  0:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-07 22:14 Info-dir-remove-duplicates is slow Helmut Eller
2005-08-08  0:29 ` Thien-Thi Nguyen

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).