Gnus development mailing list
 help / color / mirror / Atom feed
From: Romain Francoise <romain@orebokech.com>
Subject: Re: No Gnus v0.4 / emacs-cvs terribly slowly operating on large nnfolders
Date: Mon, 20 Mar 2006 22:44:38 +0100	[thread overview]
Message-ID: <87acbku6yh.fsf@pacem.orebokech.com> (raw)
In-Reply-To: <87mzfl87eu.fsf@denkblock.local> (Elias Oltmanns's message of "Mon, 20 Mar 2006 16:25:45 +0100")

Elias Oltmanns <oltmanns@uni-bonn.de> writes:

> So far I managed to rule out search-* and re-search-*.

How?

> Still, I have the feeling that it might be one of those seeking
> commands, however, I didn't manage to profile goto-char which was my
> next guess.

Quite unlikely... `goto-char' can take its sweet time to move around in
very large buffers, but *three seconds in one call*?

I think the problem with this function is that we call `search-forward'
and `re-search-forward' alternatively for each message, which duplicates
all the work of setting up Boyer-Moore tables, and possibly just
thrashes search caches between each call.

I get a very significant performance boost with this simple patch which
just merges the two searches into one: on a 65M file, calling the
function now takes 10 seconds instead of 23 on my (slow) machine.  Could
you try it out?

--- nnfolder.el	09 Feb 2006 08:33:47 +0100	7.16
+++ nnfolder.el	20 Mar 2006 22:39:42 +0100	
@@ -405,12 +405,10 @@ the group.  Then the marks file will be 
     (when nnfolder-current-buffer
       (set-buffer nnfolder-current-buffer)
       (goto-char (point-min))
-      (let ((marker (concat "\n" nnfolder-article-marker))
-	    (number "[0-9]+")
-	    numbers)
-	(while (and (search-forward marker nil t)
-		    (re-search-forward number nil t))
-	  (let ((newnum (string-to-number (match-string 0))))
+      (let ((head (concat "\n" nnfolder-article-marker "\\([0-9]+\\)"))
+	     numbers)
+	(while (re-search-forward head nil t)
+	  (let ((newnum (string-to-number (match-string 1))))
 	    (if (nnmail-within-headers-p)
 		(push newnum numbers))))
       ;; The article numbers are increasing, so this result is sorted.

-- 
Romain Francoise <romain@orebokech.com> | The sea! the sea! the open
it's a miracle -- http://orebokech.com/ | sea! The blue, the fresh, the
                                        | ever free! --Bryan W. Procter



  reply	other threads:[~2006-03-20 21:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-20  0:23 Elias Oltmanns
2006-03-20  6:02 ` Daniel Pittman
2006-03-20  9:52   ` Elias Oltmanns
2006-03-20 11:30     ` Daniel Pittman
2006-03-20 15:25       ` Elias Oltmanns
2006-03-20 21:44         ` Romain Francoise [this message]
2006-03-20 23:33           ` Elias Oltmanns
2006-03-21 12:29             ` Romain Francoise
2006-03-20 23:36           ` Miles Bader
2006-03-21 12:13             ` Romain Francoise
2006-03-22  1:07           ` James Cloos

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=87acbku6yh.fsf@pacem.orebokech.com \
    --to=romain@orebokech.com \
    /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).