Gnus development mailing list
 help / color / mirror / Atom feed
* performance respooling articles in nnmbox or nnbabyl
@ 1996-03-16  1:30 Greg Stark
  1996-03-16  9:58 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Greg Stark @ 1996-03-16  1:30 UTC (permalink / raw)



Hypothetically speaking, i was helping  set up a new user who wanted to use
nnmbox as his backend.  He had everything set up fine and it came time to set
up a nnmail-split-method.  After setting up an nnmail-split method he would
just bave to use Br to respool all the articles into groups, right?

The problem is that nnmbox and nnbabyl use a single file for all the groups
and use the Gnus-* headers to indicate which group an article is in.  To
refile an article, all that's necessary is to change the header, in theory. In
practice Gnus deletes the old message inserts the message in a new buffer,
edits the text there, then inserts that text at the other end of the buffer.

Think about how the buffer gap has to move to accomplish this when respooling
the entire nnmbox; the behaviour is absolutely pessimized.  The buffer gap has
to move back and forth across the entire nnmbox file for each delete and
insert, meaning emacs has to do the equivalent of an memmove of the entire
nnmbox file in memory twice for each respool.  Since each movement has to
cover N articles, and it has to do 2N movemements, this respooling algorithm
should run in N^2 time.

I'm not 100% emacs 19.30 still has to do this, there are a lot of obvious
optimizations emacs could do for operations at the end of buffers, but i'm
pretty sure the multiple gap code never made it into the mainline source.
But there's no real reason such a simple operation doing so much work anyways.

If it just went through and editted the headers for each article it would only
have to move the gap over each article once in sequence, the equivalent of a
single movement over the entire buffer.  In other words it should run in order
N time.  If there's no clean way to get this behaviour without breaking the
abstraction barriers (it looks like it shouldn't be too hard to me) then
another order N algorithm would be to process all the deletions first then
insert all of them at the end. I think this algorithm would still be doing
more work than the header editting one, though i can't be sure.
 
I hope the optimization splurge continues even after this release, and i hope
you pay attention to algorithmic optimizations and not just minor tweaks like
choosing which primitives to use.  I suspect there are still a lot of N^2
algorithms lying around even after that patch in gnu.emacs.gnus that changed a
lot of them.  In particular, killing lots newsgroups still seems slow.

greg


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

end of thread, other threads:[~1996-03-18 22:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-03-16  1:30 performance respooling articles in nnmbox or nnbabyl Greg Stark
1996-03-16  9:58 ` Lars Magne Ingebrigtsen
1996-03-17 18:27   ` Greg Stark
1996-03-18 16:18     ` Lars Magne Ingebrigtsen
1996-03-17 18:39   ` Greg Stark
1996-03-18 16:18     ` Lars Magne Ingebrigtsen
1996-03-18 17:40       ` Greg Stark
1996-03-18 22:10         ` Lars Magne Ingebrigtsen

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).