pan-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pan-devel] A proposal for faster threading.


From: Charles Kerr
Subject: [Pan-devel] A proposal for faster threading.
Date: Mon, 06 Jun 2005 11:49:15 -0500
User-agent: Mozilla Thunderbird 1.0+ (X11/20050531)

I'm thinking of redoing threading so that we can remove the "threading articles" step of opening a group and would like to get some feedback on the idea:

Right now, Article has a pointer to its parent article and a list of children articles. Threading is done in a big pass after a group load, so that all the articles are in memory for us to find an article's right parent. The big pass is repeated after an xover.

I'm thinking of moving the parent/child fields out of Article so that Article, by itself, won't know who its relations are. A new, second struct will hold that information:

   ArticleNode
   {
      gchar * _message_id;
      Article * _article;
      ArticleNode * _parent;
      ArticleNode ** _children;
   };

So it's a simple tree. The advantage is that by separating Article's fields (subject, date, etc.) from the hierarchy fields (parent, children), we can build the latter without the former, and fill in the former as we load/xover more headers.

Let's say we get this message:

  Subject: foo
  References: <address@hidden> <address@hidden> <address@hidden>
  Message-Id: <address@hidden>

We look in a Message-ID -> ArticleNode* lookup table for <address@hidden>.
Since it's a new message there's no match, so we create a new Node,
populate it with _article=a and _message_id=<address@hidden>, and add it to the lookup table.

Next we start walking backwards through the References: header.
We look for <address@hidden> in our lookup table.  If it's there, we link it
to <address@hidden>.  If it's not there, we create it, populate it with
_article=0 and _message_id=<address@hidden>, add it to the lookup table,
and link it to <address@hidden> anyway.  We repeat for the rest of References:.

Later, if/when <address@hidden> comes in from load/xover, all we have to do is set the _article field in the <address@hidden> ArticleNode.

So threading happens progressively, rather than requiring a separate step at the end of loading. Moreover, an article is threaded exactly once, rather than once at load and then once per each xover.

This wouldn't affect the header pane, which would filter out empty ArticleNodes if it even knew about them at all.

Any thoughts or suggestions?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]