all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmx.net>
Subject: simple patch for `etags.el'
Date: Mon, 20 Sep 2004 16:50:26 -0200	[thread overview]
Message-ID: <200409201650.26315.pogonyshev@gmx.net> (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))
 

             reply	other threads:[~2004-09-20 18:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-20 18:50 Paul Pogonyshev [this message]
2004-09-21  1:25 ` simple patch for `etags.el' 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

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

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

  git send-email \
    --in-reply-to=200409201650.26315.pogonyshev@gmx.net \
    --to=pogonyshev@gmx.net \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.