[PATCH] speedup in KMimeTypeFactory?

Matt Rogers mattr at kde.org
Mon Oct 20 16:06:33 BST 2008


On Sunday 19 October 2008 21:56:25 Matt Rogers wrote:
> 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

And after rebuilding with the Debug build type rather than the debugfull build 
type, there's virtually no speedup provided by my patch, so it can be ignored. 
:)
-- 
Matt




More information about the kde-core-devel mailing list