On Thu, Jul 16, 2015 at 05:37:46PM -0700, Ian Zimmerman wrote: > On 2015-07-16 18:50 -0500, Derek Martin wrote: > > > > for lseek() to be useful, you need to know where to lseek to > > > which you wouldn't in this case (if you want reliable parsing). > > > > That's easy though, obviously you need to fully parse unread messages, > > but once they're parsed, you just cache the offsets. > > What about deleting messages? What about editing (which mutt allows) or > rethreading? Any of these actions will invalidate the offsets.
Delete may or may not (it just sets a flag--I've long thought that mbox should have a fixed-width flag header so this can just be overwritten in place); but that need not necessarily be written out until the user syncs--a natural time to do a reparse. Expunging messages clearly would, as well as editing... but those operations are relatively rare. You'd need to reparse anyway, so... just do that. But you only need to reparse from the first modified message, so keeping the cache saves you some work even in that case. With mbox's typical use cases, it's far more likely that you'll modify messages near the end of the file than near the beginning, so usually this won't be a very costly operation. With very large mbox mailboxes, the time savings would be HUGE for typical usage patterns. The downside is, it's a lot more complex. -- Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0xDFBEAD02 -=-=-=-=- This message is posted from an invalid address. Replying to it will result in undeliverable mail due to spam prevention. Sorry for the inconvenience.
pgp8rPb0s84TZ.pgp
Description: PGP signature