[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-optimize
Subject: Re: comments on KDE performance tips
From: Simon Hausmann <hausmann () kde ! org>
Date: 2003-01-18 10:13:06
[Download RAW message or body]
On Sat, Jan 18, 2003 at 02:16:42AM +0100, Roger Larsson wrote:
> Note: there will be only one string constant "hallo" stored in the program
> due to g++ option '-fmerge-constants' (default with -O2)
> That is why we have QConstString, as a bonus space is saved and that
> reduces time too. Less cache/pages misses.
> if (QConstString("hallo") == QConstString("hallo")) ...
> // cheap constructors, no copy, comp ares only string storage location,
> // cheap destructors
>
> const QConstString bye = "bye"; // cheap constructor with no copy
> if (bye == bye) ... // only compares string storage location
Neither of these two QConstString usages do work nor are they
intended to work, because it expects raw QChar data and does not
provide a == operator because it privately inherits from QString.
If you operate on a raw array of QChar data like this you could use
it:
QChar *blah = ...
uint blahLength = ...
QChar *blubb = ...
uint blubbLength = ...
if ( QConstString( blah, blahLength ).string() ==
QConstString( blubb, blubbLength ).string() ) {
But this is equal to a pointer comparison, except that it's slower,
for the temporary objects being created.
Simon
_______________________________________________
Kde-optimize mailing list
Kde-optimize@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-optimize
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic