unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* simple patch for `etags.el'
@ 2004-09-20 18:50 Paul Pogonyshev
  2004-09-21  1:25 ` Paul Pogonyshev
  2004-09-21 18:31 ` Richard Stallman
  0 siblings, 2 replies; 15+ messages in thread
From: Paul Pogonyshev @ 2004-09-20 18:50 UTC (permalink / raw)


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  <pogonyshev@gmx.net>

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

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

end of thread, other threads:[~2004-09-24  3:21 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-20 18:50 simple patch for `etags.el' Paul Pogonyshev
2004-09-21  1:25 ` Paul Pogonyshev
     [not found]   ` <200409210006.24183.pogonyshev@gmx.net>
2004-09-21  2:08     ` Paul Pogonyshev
2004-09-22  7:11   ` Richard Stallman
2004-09-23  0:30     ` Paul Pogonyshev
2004-09-23 16:45       ` Richard Stallman
2004-09-24  3:21         ` Paul Pogonyshev
2004-09-21 18:31 ` Richard Stallman
2004-09-22  0:04   ` Paul Pogonyshev
2004-09-22  8:08     ` Kim F. Storm
2004-09-22 14:04       ` Paul Pogonyshev
2004-09-22 11:47         ` Kim F. Storm
2004-09-22 12:09           ` David Kastrup
2004-09-22 20:22           ` Paul Pogonyshev
2004-09-23  9:30             ` Richard Stallman

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