KConfig sync speedup patch rev 1
Simon Hausmann
hausmann at kde.org
Tue Sep 9 14:33:04 BST 2003
On Tue, Sep 09, 2003 at 09:09:38AM -0400, Ian Reinhart Geiser wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
> At n7y I worked out this patch with the help of david. It seems to speed up
> some apps when i measure them with calltree. The issue was that before this
> patch every time you call sync the config file is reparsed. This patch
> causes the config file not to be reparsed unless it has changed on disk since
> the last write.
Excellent idea :)
Two things I spotted:
> class QFile;
>@@ -280,6 +281,7 @@
> virtual void virtual_hook( int id, void* data );
> private:
> KConfigINIBackEndPrivate *d;
>+ QDateTime bModTime;
> };
I think you need to re-use the d pointer here, as the class is part
of the public API.
>+#include <execinfo.h>
>+#include <stdlib.h>
>+
>+static QString qBacktrace( int levels = -1 )
>+{
>+ QString s;
>+ void* trace[256];
>+ int n = backtrace(trace, 256);
>+ char** strings = backtrace_symbols (trace, n);
>+
>+ if ( levels != -1 )
>+ n = QMIN( n, levels );
>+ s = "[\n";
>+
>+ for (int i = 0; i < n; ++i)
>+ s += QString::number(i) +
>+ QString::fromLatin1(": ") +
>+ QString::fromLatin1(strings[i]) + QString::fromLatin1("\n");
>+ s += "]\n";
>+ free (strings);
>+ return s;
>+}
>+
I guess this isn't meant to be part of the patch :)
Simon
More information about the kde-core-devel
mailing list