From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/39035 Path: main.gmane.org!not-for-mail From: Dan Christensen Newsgroups: gmane.emacs.gnus.general Subject: Re: faster gnus-summary-from-or-to-or-newsgroups Date: Sat, 29 Sep 2001 20:50:22 -0400 Sender: owner-ding@hpc.uh.edu Message-ID: <87k7yhqz75.fsf@uwo.ca> References: <8766b2gqhj.fsf@uwo.ca> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1035174806 25698 80.91.224.250 (21 Oct 2002 04:33:26 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 04:33:26 +0000 (UTC) Return-Path: Original-Received: (qmail 6045 invoked from network); 30 Sep 2001 00:51:34 -0000 Original-Received: from malifon.math.uh.edu (mail@129.7.128.13) by mastaler.com with SMTP; 30 Sep 2001 00:51:34 -0000 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 15nUoo-00025G-00; Sat, 29 Sep 2001 19:50:54 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Sat, 29 Sep 2001 19:50:30 -0500 (CDT) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id TAA14336 for ; Sat, 29 Sep 2001 19:50:19 -0500 (CDT) Original-Received: (qmail 6032 invoked by alias); 30 Sep 2001 00:50:36 -0000 Original-Received: (qmail 6027 invoked from network); 30 Sep 2001 00:50:36 -0000 Original-Received: from pony.its.uwo.ca (129.100.2.63) by gnus.org with SMTP; 30 Sep 2001 00:50:36 -0000 Original-Received: from pony.its.uwo.ca (hurdle.its.uwo.ca [129.100.2.108]) by pony.its.uwo.ca (8.12.0/8.12.0) with ESMTP id f8U0q4aR011325 for ; Sat, 29 Sep 2001 20:52:04 -0400 (EDT) Original-Received: from scratchy (ren.math.uwo.ca [129.100.75.76]) by pony.its.uwo.ca (8.12.0/8.12.0) with ESMTP id f8U0q4pn011319 for ; Sat, 29 Sep 2001 20:52:04 -0400 (EDT) Original-Received: from jdc by scratchy with local (Exim 3.32 #1 (Debian)) id 15nUoJ-0006kt-00; Sat, 29 Sep 2001 20:50:23 -0400 Original-To: ding@gnus.org Mail-Copies-To: never In-Reply-To: <8766b2gqhj.fsf@uwo.ca> (Dan Christensen's message of "Sun, 02 Sep 2001 00:34:48 -0400") Original-Lines: 37 User-Agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.100 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:39035 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:39035 --=-=-= Dan Christensen 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=gnus-sum.el.patch --- 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 --=-=-=--