Gnus development mailing list
 help / color / mirror / Atom feed
From: Dan Christensen <jdc+news@uwo.ca>
Subject: Re: faster gnus-summary-from-or-to-or-newsgroups
Date: Sat, 29 Sep 2001 20:50:22 -0400	[thread overview]
Message-ID: <87k7yhqz75.fsf@uwo.ca> (raw)
In-Reply-To: <8766b2gqhj.fsf@uwo.ca> (Dan Christensen's message of "Sun, 02 Sep 2001 00:34:48 -0400")

[-- Attachment #1: Type: text/plain, Size: 1034 bytes --]

Dan Christensen <jdc+news@uwo.ca> writes:

> I've managed to increase the speed of summary buffer generation
> by about 20% by rewriting gnus-summary-from-or-to-or-newsgroups
> (the %n spec).

[...]

> The changes I made are:
>
> 1) call mail-header-extra only if needed, and at most once
> 2) don't do the string-match more than once
> 3) don't call gnus-decode-encode-word-function more than once
> 4) use gnus-tmp-from instead of (mail-header-from header)

[...]

> The bottleneck is probably now in mail-extract-address-components
> (what I have gnus-extract-address-components set to).  Does someone
> want to tackle speeding that up without reducing its accuracy?
>
> Also, I noticed that removing the %d spec speeds up the generation of
> my summary buffers by about 30%!  Does anyone want to try speeding up
> the corresponding function?

I signed and sent in my copyright assignment papers a couple of weeks
ago.  I've attached the above change as a patch.  Could someone apply
it?

Dan

-- 
Dan Christensen
jdc+news@uwo.ca


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnus-sum.el.patch --]
[-- Type: text/x-patch, Size: 2186 bytes --]

--- gnus-sum.el.orig	Sat Sep 29 20:29:42 2001
+++ gnus-sum.el.jdc	Sat Sep 29 20:45:54 2001
@@ -2904,32 +2904,31 @@
    (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
    (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
 
+(defun gnus-summary-extract-address-component (from)
+  (or (car (funcall gnus-extract-address-components from))
+      from))
+
 (defun gnus-summary-from-or-to-or-newsgroups (header)
-  (let ((to (cdr (assq 'To (mail-header-extra header))))
-	(newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
-	(mail-parse-charset gnus-newsgroup-charset)
+  (let ((mail-parse-charset gnus-newsgroup-charset)
+	; Is it really necessary to do this next part for each summary line?
+	; Luckily, doesn't seem to slow things down much.
 	(mail-parse-ignored-charsets
 	 (save-excursion (set-buffer gnus-summary-buffer)
 			 gnus-newsgroup-ignored-charsets)))
-    (cond
-     ((and to
-	   gnus-ignored-from-addresses
-	   (string-match gnus-ignored-from-addresses
-			 (mail-header-from header)))
-      (concat "-> "
-	      (or (car (funcall gnus-extract-address-components
-				(funcall
-				 gnus-decode-encoded-word-function to)))
-		  (funcall gnus-decode-encoded-word-function to))))
-     ((and newsgroups
-	   gnus-ignored-from-addresses
-	   (string-match gnus-ignored-from-addresses
-			 (mail-header-from header)))
-      (concat "=> " newsgroups))
-     (t
-      (or (car (funcall gnus-extract-address-components
-			(mail-header-from header)))
-	  (mail-header-from header))))))
+    (or
+     (and gnus-ignored-from-addresses
+	  (string-match gnus-ignored-from-addresses gnus-tmp-from)
+	  (let ((extra-headers (mail-header-extra header))
+		to
+		newsgroups)
+	    (cond
+	     ((setq to (cdr (assq 'To extra-headers)))
+	      (concat "-> "
+		      (gnus-summary-extract-address-component
+		       (funcall gnus-decode-encoded-word-function to))))
+	     ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
+	      (concat "=> " newsgroups)))))
+     (gnus-summary-extract-address-component gnus-tmp-from))))
 
 (defun gnus-summary-insert-line (gnus-tmp-header
 				 gnus-tmp-level gnus-tmp-current

  reply	other threads:[~2001-09-30  0:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-02  4:34 Dan Christensen
2001-09-30  0:50 ` Dan Christensen [this message]
2001-09-30 11:00   ` Simon Josefsson

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=87k7yhqz75.fsf@uwo.ca \
    --to=jdc+news@uwo.ca \
    /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.
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 NNTP newsgroup(s).