[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
simple patch for `etags.el'
From: |
Paul Pogonyshev |
Subject: |
simple patch for `etags.el' |
Date: |
Mon, 20 Sep 2004 16:50:26 -0200 |
User-agent: |
KMail/1.4.3 |
This patch speeds building of tags table completion up several
times.
The best way to check: `M-x tags-reset-tags-tables', then kill
all `TAGS' buffers, then type `M-. TAB'. Repeat for original
and patched versions. If you test on a large tags table (e.g.
`emacs/src/TAGS'), the difference in speed will be obvious.
Paul
P.S. I assigned copyright to FSF.
2004-09-20 Paul Pogonyshev <address@hidden>
* progmodes/etags.el (etags-tags-completion-table): Report
progress percentage only when it changes (speedup).
--- etags.el 28 Aug 2004 13:30:31 -0200 1.181
+++ etags.el 20 Sep 2004 16:44:09 -0200
@@ -1230,6 +1230,7 @@ where they were found."
(defun etags-tags-completion-table ()
(let ((table (make-vector 511 0))
(point-max (/ (float (point-max)) 100.0))
+ (next-notch 0)
(msg-fmt (format
"Making tags completion table for %s...%%d%%%%"
buffer-file-name)))
@@ -1253,7 +1254,14 @@ where they were found."
(buffer-substring (match-beginning 5) (match-end 5))
;; No explicit tag name. Best guess.
(buffer-substring (match-beginning 3) (match-end 3)))
- (message msg-fmt (/ (point) point-max)))
+ ;; Only report progress percentage when it changes.
+ ;; Otherwise, this function spends most of the time
+ ;; somewhere in `(message ...)' form.
+ (when (>= (point) next-notch)
+ (let ((percentage (truncate (/ (point) point-max))))
+ (message msg-fmt percentage)
+ (setq next-notch (ceiling (* (1+ percentage)
+ point-max))))))
table)))
table))
- simple patch for `etags.el',
Paul Pogonyshev <=
Re: simple patch for `etags.el', Richard Stallman, 2004/09/21