Revision 7af829a...

Go back to digest for 17th November 2013

Optimization in KDE Base

David Faure committed changes in [kdelibs/KDE/4.12] /config:

KConfigXT performance fix: no need to reparse when nothing to save

Somehow I forgot to commit this after review 103166 was approved
(for KDE/4.7, in 2011 !!!). Not sure why it was "marked as submitted",
I couldn't find this commit in any branches.

Closing a kmail composer window takes a very long time, because it's calling
writeConfig() on 7 kconfigskeleton objects (see KMKernel::slotSyncConfig), and
each of them calls KConfig::sync() [that's ok, it doesn't do anything if there's
no change to save, i.e. no dirty entry] followed by readConfig(), which calls
KConfig::reparseConfiguration(). That's a lot of config file parsing, for a
case where *nothing has changed*.

Looking into the history of the kconfigskeleton code didn't help finding out
why writeConfig calls readConfig, this was added by Waldo in the initial
code in 2003.

A real sync() with dirty entries triggers a reparsing (to merge changes on-disk
with changes in memory), so it makes sense to propagate the changes from KConfig
to the KConfigSkeleton member variables after a sync. But not when sync does
nothing at all.

File Changes

Modified 3 files
  • /config
  •   kdecore/kconfig.cpp
  •   kdecore/kconfig.h
  •   kdecore/kcoreconfigskeleton.cpp
3 files changed in total