[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Info-dir-remove-duplicates is slow

From: Helmut Eller
Subject: Info-dir-remove-duplicates is slow
Date: Mon, 08 Aug 2005 00:14:01 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

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.


--- 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 via email to

[Prev in Thread] Current Thread [Next in Thread]