KConfig sync speedup patch rev 1

Ian Reinhart Geiser geiseri at yahoo.com
Tue Sep 9 14:41:23 BST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 09 September 2003 09:33 am, Simon Hausmann wrote:
> 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.
>
Ah yes, smart idea... I didnt give this much thought as Im hopeful this API 
wont last much longer, but for now ill move it to a dptr.

> >+#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 :)
correct, this is nice to let us know what is calling the parse config files... 
it will be removed once the patch is complete.

Cheers
	-ian reinhart geiser
- -- 
- --:Ian Reinhart Geiser <geiseri at yahoo.com>
- --:Public Key: http://geiseri.myip.org/~geiseri/publickey.asc
- --:Public Calender: http://geiseri.myip.org/~geiseri/publicevents.ics
- --:Jabber: geiseri at geiseri.myip.org
- --:Be an optimist -- at least until they start moving animals in 
- --:   pairs to Cape Canaveral. ~ Source Unknown
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/XdiRPy62TRm8dvgRAjxJAKC/+NAe4bfxjqmVYAgsdZKmCvDLqQCglkrV
QQ2Bqvgbxl+r0sVnN+QXbWo=
=xvtO
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list