Subject: New Gnus reads full group information too often

From: John Wiegley <[email-masked]>
Date: Thu, 31 May 2012 20:01:37 -0500

I have many mailing lists in IMAP, newsgroups in NNTP, and virtual groups that
aggregate these two into topical categories.

With the latest Ma Gnus from Git:

  1. Hit 'g' to update all my Groups.  This is fast.

  2. Hit 'g' again, this is very fast.

  3. Press RET to visit any IMAP group.

  4. Hit 'g', things are still very fast.

  5. Press RET to visit any IMAP group.  Then press RET to visit any other
     IMAP group.

  6. Hit 'g'.  Now I see this in the minibuffer:

     nnimap read 876k from localhost (initial sync of 1 group; please wait)

  7. The real problem is that if I visit several groups (some upwards of
     200,000 messages on the IMAP server), the next time I hit 'g' it will
     read many tens of megabytes from every one of those groups, taking more
     than a minute and completely locking up Emacs.

This is new behavior, as I always run the following after hitting 'g':

--8<---------------cut here---------------start------------->8---
(defun gnus-score-groups (&optional arg)
  (interactive)
  (save-excursion
    (dolist (info (cdr gnus-newsrc-alist))
      ;; Only consider this group if it's at or below the current level
      (when (<= (gnus-info-level info)
                (if (numberp arg)
                    arg
                  (or (gnus-group-default-level nil t)
                      (funcall
                       (symbol-function 'gnus-group-default-list-level))
                      gnus-level-subscribed)))
        (let* ((group (gnus-info-group info))
               (unread (gnus-group-unread group)))
          (when (and (string-match "^\\(list\\.\\|nntp\\+LocalNews:\\)" group)
                     (not (string= "INBOX" group))
                     (numberp unread) (> unread 0))
            (ignore-errors
              (gnus-summary-read-group group nil t))
            (when (and gnus-summary-buffer
                       (buffer-live-p gnus-summary-buffer)
                       (eq (current-buffer)
                           (get-buffer gnus-summary-buffer)))
              (message "Exiting summary for group %s ..." group)
              (gnus-summary-exit))))))))
--8<---------------cut here---------------end--------------->8---

This visits every IMAP or NNTP group that uses adaptive scoring, so that the
resulting unread counts reflect reality.  Yet after I run this, Gnus does an
"initial sync" of 33 or more groups, bringing Emacs to its knees every time.

I started noticing this behavior in the last couple days.  I've updated Gnus
twice in that time (I think).  Right now I'm at commit 1bd6e87.

Thanks,
  John Wiegley

Ma Gnus v0.6
GNU Emacs 23.4.1 (x86_64-apple-darwin11.2.0, Carbon Version 1.6.0 AppKit 1138.23)
 of 2012-01-31 on vulcan
200 Leafnode NNTP daemon, version 2.0.0.alpha20110815a.luascript at newartisans.com 
500 Unknown command