🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87917

rmail-summary-goto-msg slow for large summaries

#87917
From: Marc Auslander
Date: Thu, 11 Aug 1994 00:29
59 lines
2735 bytes
In GNU Emacs 19.25.93.3 (rs6000-ibm-aix3.2.5) of Wed Aug 10 1994 on marc.watson.ibm.com

the slowness of rmail when a large summary is in force is caused by
the re-search for the line in the summary with the correct message
number in rmail-summary-goto-msg.

I have written a binary search to speed the up.  The patch follows.

I have tested it in the obvious ways.


Marc Auslander   <marc@watson.ibm.com>   914 784-6699  (Tieline 863 Fax x6306)

*** lisp/rmailsum.el	Mon Aug  1 22:26:07 1994
--- rmailsum.el	Wed Aug 10 14:12:17 1994
***************
*** 768,773 ****
--- 768,791 ----
  
  (defvar rmail-summary-overlay nil)

+ (defun rmail-summary-find-msg (n)
+   (let ((start (point-min)) (diff (/(- (point-max) (point-min)) 2)) found)
+     (while (> diff 1000)
+       (setq start (+ start diff))
+       (goto-char start)
+       (beginning-of-line)
+       (skip-chars-forward " ")
+       (if (> (string-to-int (buffer-substring
+ 				     (point)
+ 				     (progn (skip-chars-forward "0-9")
+ 					    (point))))
+ 	     n)
+ 	  (setq start (- start diff)))
+       (setq diff (/ diff 2)))
+     (goto-char start)
+     (beginning-of-line)
+     (re-search-forward (concat "^ *" (int-to-string n)) nil t)))
+
  (defun rmail-summary-goto-msg (&optional n nowarn skip-rmail)
    (interactive "P")
    (if (consp n) (setq n (prefix-numeric-value n)))
***************
*** 793,799 ****
  		 (goto-char (point-max))
  		 (rmail-summary-goto-msg)))
        (goto-char (point-min))
!       (if (not (re-search-forward (concat "^ *" (int-to-string n)) nil t))
  	  (progn (or nowarn (message "Message %d not found" n))
  		 (setq n curmsg)
  		 (setq message-not-found t)
--- 811,817 ----
  		 (goto-char (point-max))
  		 (rmail-summary-goto-msg)))
        (goto-char (point-min))
!       (if (not (rmail-summary-find-msg n))
  	  (progn (or nowarn (message "Message %d not found" n))
  		 (setq n curmsg)
  		 (setq message-not-found t)
Technical Details
Message-ID: <9408101819.AA14929@marc.watson.ibm.com>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!primenet!netnews.asu.edu !asuvax!cs.utexas.edu!usc!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!watson.ibm.com!marc

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,2d74fbcc33233b79,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-08-11 15:22:56 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!primenet!netnews.asu.edu      !asuvax!cs.utexas.edu!usc!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!watson.ibm.com!marc
From: marc@watson.ibm.com (Marc Auslander)
Newsgroups: gnu.emacs.bug
Subject: rmail-summary-goto-msg slow for large summaries
Date: 10 Aug 1994 20:29:49 -0400
Organization: GNUs Not Usenet
Lines: 60
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <9408101819.AA14929@marc.watson.ibm.com>
Reply-To: marc@watson.ibm.com