🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.gnus
Article #81466

Speedup for nntp.el

#81466
From: Ken McGlothlen
Date: Wed, 20 Jan 1993 00:36
137 lines
5369 bytes
Good grief.  I never expected more than maybe five responses, and wound up with
over 25 just today.  Eek.

Following is the changes to nntp.el I made a while back; it's a fairly healthy
speedup on its own, particularly when starting up GNUS or when GNUS is reading
in a long article.  It's being posted as a context diff.

vvvv-----CUT HERE-----CUT HERE-----CUT HERE-----CUT HERE-----CUT HERE-----vvvv
*** /usr/local/emacs/lisp/nntp.el	Mon Jan 20 18:08:05 1992
--- emacs/nntp.el	Tue Jan 19 16:25:56 1993
***************
*** 2,7 ****
--- 2,10 ----
  ;; Copyright (C) 1987, 1988, 1989 Fujitsu Laboratories LTD.
  ;; Copyright (C) 1987, 1988, 1989, 1990 Masanobu UMEDA
  ;; $Header: nntp.el,v 3.10 90/03/23 13:25:27 umerin Locked $
+ ;; Modified slightly by Ken McGlothlen (mcglk@cpac.washington.edu), in a
+ ;;   desperate attempt to make GNUS faster, by modifying the
+ ;;   "NNTP: Reading..." messages.  All my mods are flagged with ";Mcglk:"
  
  ;; This file is part of GNU Emacs.
  
***************
*** 511,521 ****
        t)
      ))
  
  (defun nntp-wait-for-response (regexp)
    "Wait for server response which matches REGEXP."
    (save-excursion
      (let ((status t)
! 	  (wait t))
        (set-buffer nntp-server-buffer)
        ;; Wait for status response (RFC977).
        ;; 1xx - Informative message.
--- 514,533 ----
        t)
      ))
  
+ ;Mcglk: I've changed this function so that instead of flashing
+ ;  "NNTP: Reading..." for EVERY SINGLE NNTP PACKET, it now displays the
+ ;  "Reading..." message during the entire process, flipping the last period of
+ ;  the ellipsis to an asterisk every tenth packet.  It's amazing how much this
+ ;  little bitty change speeds things up, and yet it still provides some
+ ;  indication that something is actually happening.
  (defun nntp-wait-for-response (regexp)
    "Wait for server response which matches REGEXP."
    (save-excursion
      (let ((status t)
! 	  (wait t)
! 	  ;Mcglk: Add the following variable:
! 	  (packets 0)
! 	  )
        (set-buffer nntp-server-buffer)
        ;; Wait for status response (RFC977).
        ;; 1xx - Informative message.
***************
*** 542,547 ****
--- 554,560 ----
        (if status
  	  (progn
  	    (setq wait t)
+ 	    (setq packets 0)	;Mcglk: Added this line.
  	    (while wait
  	      (goto-char (point-max))
  	      (forward-line -1)		;(beginning-of-line)
***************
*** 550,563 ****
  	      ;;	 (save-excursion (end-of-line) (point))))
  	      (if (looking-at regexp)
  		  (setq wait nil)
! 		(if nntp-debug-read
! 		    (message "NNTP: Reading..."))
  		(nntp-accept-response)
! 		(if nntp-debug-read
! 		    (message ""))
  		))
  	    ;; Successfully received server response.
! 	    t
  	    ))
        )))
  
--- 563,586 ----
  	      ;;	 (save-excursion (end-of-line) (point))))
  	      (if (looking-at regexp)
  		  (setq wait nil)
! 		;Mcglk: Commented out the next two lines.
! ;		(if nntp-debug-read
! ;		    (message "NNTP: Reading..."))
! 		;Mcglk: Added the next two lines.
! 		(setq packets (1+ packets))
! 		(if (zerop (mod packets 10)) (message "NNTP: Reading..*"))
  		(nntp-accept-response)
! 		;Mcglk: Commented out the next two lines.
! ;		(if nntp-debug-read
! ;		    (message ""))
! 		;Mcglk: Added the next line.
! 		(message "NNTP: Reading...")
  		))
  	    ;; Successfully received server response.
! 	    ;Mcglk: Commented out the next line.
! ;	    t
! 	    ;Mcglk: Added the next line.
! 	    (progn (message "") t)
  	    ))
        )))
  
***************
*** 658,666 ****
        (progn
  	;; We cannot use `accept-process-output'.
  	;; Fujitsu UTS requires messages during sleep-for. I don't know why.
! 	(message "NNTP: Reading...")
  	(sleep-for 1)
! 	(message ""))
      (condition-case errorcode
  	(accept-process-output nntp-server-process)
        (error
--- 681,697 ----
        (progn
  	;; We cannot use `accept-process-output'.
  	;; Fujitsu UTS requires messages during sleep-for. I don't know why.
! 	;Mcglk: I decided that I'd change this slightly, even though I don't
! 	;  think I've ever run into this.
! 	;Mcglk: Commented out the following line.
! ;	(message "NNTP: Reading...")
! 	;Mcglk: Added the following line.
! 	(message "NNTP: Reading..-")
  	(sleep-for 1)
! 	;Mcglk: Commented out the following line.
! ;	(message ""))
! 	;Mcglk: Added the following line.
! 	(message "NNTP: Reading..."))
      (condition-case errorcode
  	(accept-process-output nntp-server-process)
        (error
^^^^-----CUT HERE-----CUT HERE-----CUT HERE-----CUT HERE-----CUT HERE-----^^^^
Technical Details
Message-ID: <MCGLK.93Jan19163655@yang.cpac.washington.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!henson!news.u.washington.edu!cpac.washington.edu!mcglk

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1016f0,e1c9a9dfcb2537b1,start
X-Google-Attributes: gid1016f0,public
X-Google-ArrivalTime: 1993-01-19 17:05:47 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!henson!news.u.washington.edu!cpac.washington.edu!mcglk
From: mcglk@cpac.washington.edu (Ken McGlothlen)
Newsgroups: gnu.emacs.gnus
Subject: Speedup for nntp.el
Message-ID: <MCGLK.93Jan19163655@yang.cpac.washington.edu>
Date: 20 Jan 93 00:36:55 GMT
Article-I.D.: yang.MCGLK.93Jan19163655
Distribution: world
Organization: Dubious.
Lines: 137
NNTP-Posting-Host: yang.cpac.washington.edu