Gnus development mailing list
 help / color / mirror / Atom feed
From: Daniel Pittman <daniel@rimspace.net>
Cc: Simon Josefsson <simon@josefsson.org>
Subject: [PATCH] nnimap performance improvement for large or old groups
Date: Fri, 03 Mar 2006 12:38:43 +1100	[thread overview]
Message-ID: <87veuwxq70.fsf@rimspace.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 941 bytes --]

One of the nagging problems with using nnimap as my primary mail store
is that it takes absolutely forever to enter my INBOX, as well as
causing XEmacs to allocate around 150MB of memory.

This is because I have been using the same INBOX for a long while now,
and the 'read' info range starts with '(1 . 695705)'

The code in `nnimap-request-update-info-internal' called
`gnus-uncompress-range' on this, resulting in a list containing around
seven million numbers -- an awful lot of memory, and time spent working
through it.

To address this I rewrote the code in that routine to work with
compressed ranges, rather than uncompressed, which gives me a huge
performance improvement (almost instant entry, vs ten to fifteen
seconds) and reduces the memory use significantly.


I don't think this is too performance-inefficient to include as is, and
it doesn't seem to adversely effect entry into small groups or anything
like that.

	Daniel


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnimap-performance.patch --]
[-- Type: text/x-patch, Size: 1454 bytes --]

? build.info
? build.sh
? nnimap-performance.patch
? contrib/auto-autoloads.el
? contrib/semantic.cache
Index: lisp/nnimap.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/nnimap.el,v
retrieving revision 7.30
diff -u -u -r7.30 nnimap.el
--- lisp/nnimap.el	21 Feb 2006 07:14:23 -0000	7.30
+++ lisp/nnimap.el	3 Mar 2006 01:37:36 -0000
@@ -1183,18 +1183,12 @@
 	  (let (seen unseen)
 	    ;; read info could contain articles marked unread by other
 	    ;; imap clients!  we correct this
-	    (setq seen (gnus-uncompress-range (gnus-info-read info))
-		  unseen (imap-search "UNSEEN UNDELETED")
-		  seen (gnus-set-difference seen unseen)
-		  ;; seen might lack articles marked as read by other
-		  ;; imap clients! we correct this
-		  seen (append seen (imap-search "SEEN"))
-		  ;; remove dupes
-		  seen (sort seen '<)
-		  seen (gnus-compress-sequence seen t)
-		  ;; we can't return '(1) since this isn't a "list of ranges",
-		  ;; and we can't return '((1)) since g-list-of-unread-articles
-		  ;; is buggy so we return '((1 . 1)).
+	    (setq unseen (gnus-compress-sequence 
+			  (imap-search "UNSEEN UNDELETED"))
+		  seen (gnus-range-difference (gnus-info-read info) unseen)
+		  seen (gnus-range-add seen 
+				       (gnus-compress-sequence 
+					(imap-search "SEEN")))
 		  seen (if (and (integerp (car seen))
 				(null (cdr seen)))
 			   (list (cons (car seen) (car seen)))

             reply	other threads:[~2006-03-03  1:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-03  1:38 Daniel Pittman [this message]
2006-03-03  9:34 ` Simon Josefsson
2006-03-04  0:00   ` Daniel Pittman
2006-03-05 22:10     ` Simon Josefsson
2006-03-15 10:32       ` Frank Schmitt
2006-03-30 18:37         ` Wes Hardaker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87veuwxq70.fsf@rimspace.net \
    --to=daniel@rimspace.net \
    --cc=simon@josefsson.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).