From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/38504 Path: main.gmane.org!not-for-mail From: Dan Christensen Newsgroups: gmane.emacs.gnus.general Subject: faster gnus-summary-from-or-to-or-newsgroups Date: Sun, 02 Sep 2001 00:34:48 -0400 Sender: Dan Christensen Message-ID: <8766b2gqhj.fsf@uwo.ca> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035174356 22776 80.91.224.250 (21 Oct 2002 04:25:56 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 04:25:56 +0000 (UTC) Return-Path: Return-Path: Original-Received: (qmail 24318 invoked from network); 2 Sep 2001 04:35:00 -0000 Original-Received: from pony.its.uwo.ca (129.100.2.63) by gnus.org with SMTP; 2 Sep 2001 04:35:00 -0000 Original-Received: from scratchy (ren.math.uwo.ca [129.100.75.76]) by pony.its.uwo.ca (8.10.2/8.10.2) with ESMTP id f824ZAm18581 for ; Sun, 2 Sep 2001 00:35:10 -0400 (EDT) Original-Received: from jdc by scratchy with local (Exim 3.32 #1 (Debian)) id 15dOy9-0004aO-00; Sun, 02 Sep 2001 00:34:49 -0400 Original-To: ding@gnus.org User-Agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.100 Original-Lines: 81 Xref: main.gmane.org gmane.emacs.gnus.general:38504 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:38504 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 original function is: (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) (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)))))) 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 result is: (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 ((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))) (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)))) If there are no complaints, could someone apply this? 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? -- Dan Christensen jdc+news@uwo.ca