Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-group-find-new-groups vs nnimap
@ 2007-08-25  4:46 James Cloos
  2007-08-29 13:17 ` Simon Josefsson
  0 siblings, 1 reply; 3+ messages in thread
From: James Cloos @ 2007-08-25  4:46 UTC (permalink / raw)
  To: ding

One issue I've seen with nnimap is that, when it is asked for new
groups (either at gnus startup or due to an explicit call to
gnus-group-find-new-groups) it EXAMINEs *every* group returned by
the call to LSUB, rather than just the new groups.  That means that
at startup EXAMINE is called on every known group *twice*.

The time loss for doing that is significant for me.  On the order
of hours.

The code looks like:

,----( from gnus/lisp/nnimap.el )
| (deffoo nnimap-request-newgroups (date &optional server)
|   (when (nnimap-possibly-change-server server)
|     (with-current-buffer nntp-server-buffer
|       (gnus-message 5 "nnimap: Listing subscribed mailboxes%s%s..."
|                     (if (> (length server) 0) " on " "") server)
|       (erase-buffer)
|       (nnimap-before-find-minmax-bugworkaround)
|       (dolist (pattern (nnimap-pattern-to-list-arguments
|                         nnimap-list-pattern))
|         (dolist (mbx (imap-mailbox-lsub (cdr pattern) (car pattern) nil
|                                         nnimap-server-buffer))
|           (or (catch 'found
|                 (dolist (mailbox (imap-mailbox-get 'list-flags mbx
|                                                    nnimap-server-buffer))
|                   (if (string= (downcase mailbox) "\\noselect")
|                       (throw 'found t)))
|                 nil)
|               (let ((info (nnimap-find-minmax-uid mbx 'examine)))
|                 (when info
|                   (insert (format "\"%s\" %d %d y\n"
|                                   mbx (or (nth 2 info) 0)
|                                   (max 1 (or (nth 1 info) 1)))))))))
|       (gnus-message 5 "nnimap: Listing subscribed mailboxes%s%s...done"
|                     (if (> (length server) 0) " on " "") server))
|     t))
`----

As far as I can tell, at the point just before (nnimap-find-minmax-uid
mbx 'examine) is called, I'd need to search for (mbx) in the current
buffer and skip the (insert) if it is found, yes?

Any suggestions on how best to accomplish that?

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnus-group-find-new-groups vs nnimap
  2007-08-25  4:46 gnus-group-find-new-groups vs nnimap James Cloos
@ 2007-08-29 13:17 ` Simon Josefsson
  2007-08-29 20:52   ` James Cloos
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Josefsson @ 2007-08-29 13:17 UTC (permalink / raw)
  To: James Cloos; +Cc: ding

James Cloos <cloos+math_uh-ding@jhcloos.com> writes:

> One issue I've seen with nnimap is that, when it is asked for new
> groups (either at gnus startup or due to an explicit call to
> gnus-group-find-new-groups) it EXAMINEs *every* group returned by
> the call to LSUB, rather than just the new groups.  That means that
> at startup EXAMINE is called on every known group *twice*.
>
> The time loss for doing that is significant for me.  On the order
> of hours.
>
> The code looks like:
>
> ,----( from gnus/lisp/nnimap.el )
> | (deffoo nnimap-request-newgroups (date &optional server)
> |   (when (nnimap-possibly-change-server server)
> |     (with-current-buffer nntp-server-buffer
> |       (gnus-message 5 "nnimap: Listing subscribed mailboxes%s%s..."
> |                     (if (> (length server) 0) " on " "") server)
> |       (erase-buffer)
> |       (nnimap-before-find-minmax-bugworkaround)
> |       (dolist (pattern (nnimap-pattern-to-list-arguments
> |                         nnimap-list-pattern))
> |         (dolist (mbx (imap-mailbox-lsub (cdr pattern) (car pattern) nil
> |                                         nnimap-server-buffer))
> |           (or (catch 'found
> |                 (dolist (mailbox (imap-mailbox-get 'list-flags mbx
> |                                                    nnimap-server-buffer))
> |                   (if (string= (downcase mailbox) "\\noselect")
> |                       (throw 'found t)))
> |                 nil)
> |               (let ((info (nnimap-find-minmax-uid mbx 'examine)))
> |                 (when info
> |                   (insert (format "\"%s\" %d %d y\n"
> |                                   mbx (or (nth 2 info) 0)
> |                                   (max 1 (or (nth 1 info) 1)))))))))
> |       (gnus-message 5 "nnimap: Listing subscribed mailboxes%s%s...done"
> |                     (if (> (length server) 0) " on " "") server))
> |     t))
> `----
>
> As far as I can tell, at the point just before (nnimap-find-minmax-uid
> mbx 'examine) is called, I'd need to search for (mbx) in the current
> buffer and skip the (insert) if it is found, yes?

Does the buffer really contains the same group information twice at that
point?  Note that the function calls (erase-buffer).  So I suspect you
won't find the information that nnimap-find-min-maxuid generates in the
buffer.  You could cache that information in some variable, but then you
run into stale-cache issues.

/Simon




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnus-group-find-new-groups vs nnimap
  2007-08-29 13:17 ` Simon Josefsson
@ 2007-08-29 20:52   ` James Cloos
  0 siblings, 0 replies; 3+ messages in thread
From: James Cloos @ 2007-08-29 20:52 UTC (permalink / raw)
  To: ding; +Cc: Simon Josefsson

>>>>> "Simon" == Simon Josefsson <simon@josefsson.org> writes:

Simon> Does the buffer really contains the same group information twice
Simon> at that point?  Note that the function calls (erase-buffer).  So
Simon> I suspect you won't find the information that
Simon> nnimap-find-min-maxuid generates in the buffer.

D’oh.  I completely missed that call to (erase-buffer)!

So the buffer doesn’t have the already known groups.  But gnus itself
does in gnus-newsrc-alist.  I suspect that means that I have to change
that function to call a putative (nnimap-maybe-find-minmax-uid) which
checks for the data in gnus’ vars and calls (nnimap-find-minmax-uid)
for as yet unknown groups.

Anyway, thanks for the catch!

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6








^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-29 20:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-25  4:46 gnus-group-find-new-groups vs nnimap James Cloos
2007-08-29 13:17 ` Simon Josefsson
2007-08-29 20:52   ` James Cloos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).