Fast IMAP open



The attached patch (against a recent CVS tree) is an experiment in speeding
up the opening of an IMAP folder tree. Only the first level of the tree is
scanned initially (depth = 1), instead of the whole tree (depth = 7!). As
nodes are made visible, subtrees are scanned, but always only to depth 1.
In principle, all children of any viewable node are in the tree, so the
expand icon is shown correctly. A new field is added to the
BalsaMailboxNode structure, to keep track of which nodes have been scanned.


The code for the progressive scanning, scan_viewable_imap_nodes, is in
src/balsa-mblist.c, as it uses balsa_app.mblist to find out what's
viewable. Also, that's where expand-subtree events are caught. However, it
also has to be called from src/mailbox-node.c, at the end of a
balsa_mailbox_node_rescan. Other changes are to src/balsa-mblist.h (to
export scan_viewable_imap_nodes) and src/mailbox-node.h (adding the new
field).

The code works for me, with my Cyrus IMAP server, and doesn't seem to
interfere with local mailboxes, but I haven't tested it very rigorously.
The startup time is cut dramatically, and the overhead associated with
expanding each part of the tree feels OK--it is noticeable, when you expose
a node with many children (DSL link).

This patch is offered for discussion only! A working version should
probably support both fast-open and full-scan modes, and a Preferences
dialog for choosing between them. Intermediate options (e.g. depth = 2)
might also be worthwhile for some situations, but I don't know how to
manage that, particularly deciding when to scan deeper.

All comments and suggestions welcome!

Peter




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