[PATCH] speedup in KMimeTypeFactory?

Matt Rogers mattr at kde.org
Mon Oct 20 21:16:15 BST 2008


On Monday 20 October 2008 12:45:28 David Faure wrote:
> 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 :)

I probably did hit that bug.. I was wondering why the number of calls to 
matchFileName dropped from 300,000+ to only 12,000 or so. :)
-- 
Matt




More information about the kde-core-devel mailing list