Revision b8aaeff...

Go back to digest for 8th June 2014

Optimization in KDE Base

Milian Wolff committed changes in [kdelibs] /config:

Optimize KConfigIniBackend::parseConfig by reducing allocations.

Yet another awesome application of the Qt implicit sharing trick.
Since config files often contain only few different keys and even
value strings, we can share them. This reduces memory consumption
and also speeds up parsing, as we do not have to allocate the
duplicated strings, but can simply reuse the previous values.

The most extreme case for this of my knowledge, is KatePart:
katesyntaxhighlightingrc has more then 20k lines which triggered
nearly 30k allocations on startup. With this patch applied, this
value goes down dramatically. I added a simple static counter for
the cache hit/miss ratio, which resulted in 5442 cache misses compared
to 43624 cache hits across all KConfig files parsed by kwrite.

REVIEW: 118587

File Changes

Modified 3 files
  • /config
  •   kdecore/bufferfragment_p.h
  •   kdecore/kconfigini.cpp
  •   kdecore/kconfigini_p.h
3 files changed in total