From kde-optimize Fri Sep 29 22:39:27 2006 From: David Faure Date: Fri, 29 Sep 2006 22:39:27 +0000 To: kde-optimize Subject: Re: Value-based classes: struct vs shared-data Message-Id: <200609300039.27689.faure () kde ! org> X-MARC-Message: https://marc.info/?l=kde-optimize&m=115956959923644 On Friday 29 September 2006 22:54, Roger Larsson wrote: > On Friday 29 September 2006 14:31, David Faure wrote: > > > Any mistakes in my test? ;) > > > > You did not tell what compiler (version) and options you used. > But I guess it was unoptimized... gcc-4.0.3, default kde-trunk buildsystem options with debugfull enabled. Let's see what happens with -O2 instead of -g3 -fno-inline... QDEBUG : KFileItemTest::testPerformance() CTOR: Simple struct: 16 QDEBUG : KFileItemTest::testPerformance() CTOR: With QSharedDataPointer: 18 QDEBUG : KFileItemTest::testPerformance() COPY CTOR: Simple struct: 5 QDEBUG : KFileItemTest::testPerformance() COPY CTOR: With QSharedDataPointer: 1 Hey that's pretty good. The performance hit for the default ctor is down to 12% while the performance hit for the copy ctor when not using qshareddatapointer is still very high (around 500%, although with '1' the number is too small to mean anything). This seems to confirm that I should go ahead with QSharedDataPointer. -- David Faure, faure@kde.org, sponsored by Trolltech to work on KDE, Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org). _______________________________________________ Kde-optimize mailing list Kde-optimize@kde.org https://mail.kde.org/mailman/listinfo/kde-optimize