KFilterDev changes from KDE3

Pino Toscano toscano.pino at tiscali.it
Tue Mar 17 21:52:20 GMT 2009


Alle martedì 17 marzo 2009, Martin Koller ha scritto:
> On Tuesday 17 March 2009, David Faure wrote:
> > > Well, I know the mimetype, but as I do a backup of a _lot_ of files,
> > > isn't the overhead too high to again and again calling
> > > findFilterByMimeType() (as the mimetype will never change during the
> > > complete backup) ?
> >
> > KFilterBase::findFilterByMimeType only loads a mimetype from ksycoca
> > (that's supposed to be really fast, just a dict lookup and a bit of
> > deserialization) and compares strings. If it really turns out to be a
> > bottleneck, we could add a cache in KFilterDev so that it remembers the
> > last requested mimetype and the KFilterBase that was created for it (with
> > care not to leak or double-delete kfilterbases...). In any case this can
> > and should be handled internally in KFilterDev.
>
> I now run a first test:
>
> ~18000 files processed: KDE4 3:02 Minutes, KDE3 2:12 Minutes ...
>
> It _is_ a bottleneck, as this was just a small test.

What about the attached patch?
This should avoid the KMimeType deserialization in case the specified mimetype 
is either exactly the one of gzip or bzip2, otherwise searching doing the 
mimetype lookup as before.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdelibs-kfilterbase.diff
Type: text/x-diff
Size: 1522 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090317/c3eeece0/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090317/c3eeece0/attachment.sig>


More information about the kde-core-devel mailing list