[Kde-pim] mixedmaildir optimization suggestion
Kevin Krammer
krammer at kde.org
Thu Sep 20 14:15:43 BST 2012
On Thursday, 2012-09-20, 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.
I'll have to look into this more closely once I find some time for that.
On cursory clance this looks good though.
> 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 was under the impression that the cache in maildir does not change the
behavior but just makes things faster by avoiding unnecessary calls.
Isn't the cache discarded when the modification time of the directory is newer
than the modification time of the cache for that directory?
The removal of a file would change the directory's modification time, this
should invalidate the cache. Any listing or file check would then rebuild the
cache, right?
Cheers,
Kevin
--
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20120920/906140fd/attachment.sig>
-------------- next part --------------
_______________________________________________
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