[Kde-pim] mixedmaildir optimization suggestion
Anders Lund
anders at alweb.dk
Thu Sep 20 09:56:21 BST 2012
On Torsdag den 20. september 2012 11:26:26 Andras Mantia wrote:
> David Faure wrote:
> > From mixedmaildirstore.cpp:
> > 370│
> > 371│ bool isValidEntry( const QString &entry ) const {
> > 372├> return mMaildir.entryList().contains( entry );
> > 373│ }
> >
> > Why list a very very big directory, just to find out if ONE file exists?
> > [entryList() is slow because it uses QDir::entryList(), which sorts by
> > [name,
> > case insensitively.... lots of toLower() calls and lots of sorting].
> >
> >
> > Shouldn't this be
> >
> > return !mMaildir.findRealKey(entry).isEmpty();
> >
> > ?
>
> Looks ok for me, but I'm not that familiar with the mixedmaildir code and
> see below.
>
> Note that it is still not that fast as with maildir, where the if the
> directory changes on the disk, there is one entryList() call that updates
> the file key cache, instead of one (or two) QFile::exists() calls like there
> will be with mixedmaildir, because here the cache is not updated
> automatically.
> I'd also say that because of this, there could be problems if a mail is
> removed from mixedmaildir's maildir part without the cache being update.
> For example, let's assume mail "foo.12345" is in a folder "bar". That would
> be on the disk "bar/cur/foo.12345".
> Calling isValidEntry("foo.12345") would find it with a QFile.exists() and
> but in the cache (see the findRealKey implementation). Upcoming calls will
> not perform the exists() but get the info from the cache.
> Now if "bar/cur/foo.12345" is removed from anything else but through
> akonadi, isValidEntry("foo.12345") would still return true, as the entry is
> in the cache.
> Might not be a new problem, as probably the whole mixedmaildir is not
> prepared for outside modifications, but it is something to keep in mind.
>
> Andras
Doesn't akonadi watch the directory, and handle removed files? Anything that
can improve maildir handling is good!
Anders
--
Anders
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list