2000-06-21-01:17:34 Ronny Haryanto:
> I'm still wondering why it's slower though (in general), maybe
> because it fopen() more times than mbox? The mailbox is on ext2fs
> if that makes any difference.

Ext2 is a nice quick FS, with many great features. One of my
favourites.

For any size mailbox, you can construct extreme examples where mbox
will be quicker, and others where Maildir will be quicker. For
opening the folder, mbox will be quicker if most of the messages are
small; Maildir will get quicker if there are enough messages that
are big enough for the Maildir not having to scan through the file
to outweight the cost of the extra file opens. By and large mbox
will be quicker on opens, in practice, but if the folder isn't too
big the difference won't hurt too much.

As the number of messages grows, another effect kicks in: ext2, like
nearly all other FSes (the few exceptions include Reiserfs, SGI's
xfs, and NetApp's WAFL --- anybody know any others?) anyway, for
nearly all FS types out there, after there are more than a few
thousand entries in a directory, operations start slowing down
dramatically, due to the OS constantly having to re-do linear
searches through the directory. I can really happily recommend
Reiserfs, works like a champ. Just make sure you put a zero in the
last column of /etc/fstab, so Linux won't try to fsck it on reboot
--- the Reiserfs fsck isn't ready for prime-time. Fortunately, it's
not needed either.

Back to our muttons, the above performance discussion focused on
opening the folder. Once it's open, mutt has built an in-memory data
structure describing the messages, and either their offsets in the
mbox file, or the filenames where they can be directly accessed in
the Maildir. So most operations are fast. Until it comes time to
save changes; then deletions require rewriting an entire mbox, while
they just require deleting the specific message files in a Maildir,
so Maildirs can be way faster there.

And then there are the manipulations outside of the MUA. Maildir
wins there, at least for me. I _love_ the simplicity and reliability
of delivering to it; it's trivial to do so very safely and robustly
even from a portable Bourne Shell script. Scanning mailboxes for
messages matching patterns is a piece o' cake with Unix shell tools,
likewise migrating older messages to archival folders, indexing them
with a full-text search tool like e.g. Glimpse, etc.

Mark Crispin, author of the IMAP protocol, and more interestingly
the C-Client library that underlies the UW imapd and the pine Mail
User Agent, abhors Maildir, and it's illustrative to note why:
he bases his design decisions on the performance of his microvax
running ultrix or some such, which has an excruciatingly slow
filesystem compared to e.g. ext2. It can work up a reasonable
sequential read speed, but file operations like create and delete,
and even open/close, are pathetic, so he sees a nightmarishly huge
performance penalty for the one-file-per-message formats like
Maildir.

-Bennett

PGP signature

Reply via email to