bring speed back into KConfig

Alexander Neundorf neundorf at kde.org
Fri Apr 18 00:36:51 CEST 2008


On Friday 18 April 2008, Jakub Stachowski wrote:
> Dnia czwartek, 17 kwietnia 2008, Olivier Goffart napisał:
> > Le mardi 15 avril 2008, Dirk Mueller a écrit :
> > > Hi,
> > >
> > > the "knotify4 eats cpu" bugreport seems to be highly popular, so the
> > > reason for that seems to be the incredible performance loss in
> > > KConfigIni due to the "kconfig refactoring branch" being merged last
> > > autumn by Andreas Pakulat.
> >
> > Oh, i though it was a problem in the xine backend, which is why i did not
> > spend much attention to it.
> > I may have a closer look.
>
> I did some more optimizing to  minimize copying data around. Instead of
> using QByteArray everywhere I added class BufferFragment with very similar
> (bare minimum used by parser) API, but operating on allocated earlier big
> buffer. like left(), trim(), mid(), etc. are only pointer and int
> operations.
>
> Results:
>  - 500x parsing of kwin.notifyrc takes 1.3s instead of 5.8s
>  - KConfig from KDE3 takes 1.4s
>  - kconfig unit test pass

Very cool :-)

> BufferFragment class contains very short functions (most of them 1-3 lines)
> that could be inlined, so all definitions are in header file. Is it OK or
> separate .cpp file is necessary?

Not sure. Having it inline makes it faster but there can be (binary ?) 
compatibility issues. I don't know if that matters here, since it's just an 
internal header.

Alex


More information about the Kde-optimize mailing list