[PATCH] speedup in KMimeTypeFactory?

Matt Rogers mattr at kde.org
Mon Oct 20 03:56:25 BST 2008


On Sun, Oct 19, 2008 at 10:48:30AM +0200, Ingo Klöcker 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.
> 
> 
> One suggestion:
> > +    int leftBracketIndex = pattern.indexOf(leftBracket);
> 
> Use
> 
> +    const int leftBracketIndex = pattern.indexOf(leftBracket);
> 
> instead. This will not make the code faster, but it will give other 
> people reading this code the hint that this variable isn't changed 
> afterwards. In general, we should constify anything that can be 
> constified.
> 

Thanks for the suggestion!
--
Matt





More information about the kde-core-devel mailing list