[PATCH] speedup in KMimeTypeFactory?

David Faure faure at kde.org
Mon Oct 20 18:45:28 BST 2008

On Sunday 19 October 2008, Matt Rogers wrote:
> The attached patch makes some changes to the matchFileName function in 
> kmimetypefactory.cpp which gets called a lot, especially when browsing files 
> in the file manager when trying to open a file.

You were probably hitting the bug which I introduced in r871471 on Wednesday
and fixed in r872464 on Friday: the pattern list was loaded from ksycoca at every
call to KMimeTypeFactory::fromFileName, because I forgot to set the bool loaded to true.
So it ended up checking 10000+ patterns instead of 200 or so.
The time spent in matchFileName itself is not so big anymore when it's not called more
often than it should :)

David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

More information about the kde-core-devel mailing list