[upd alt PATCH] Re: [PATCH] KURL optimizations

Roger Larsson kde-optimize@mail.kde.org
Sun, 12 Jan 2003 03:49:14 +0100


On Saturday 11 January 2003 17:39, Maks Orlovich wrote:
> On Saturday 11 January 2003 04:34 am, Roger Larsson wrote:
> > My patch again, rolls back the QString_lower changes and
> > add some other optimizations.
> >
> > I am not sure that removing KGlobal::staticQString fileProt is a win.
> > But it should be faster at least the first time...
> > fileProt should probably be a static const in the class...
> >
> > Maks, could you benchmark this?
>=20
> Too close to tell it apart speed wise, since ther eis a lot of variabilit=
y.=20
So=20
> looks like calling ->lower() per char costs about the same as the new str=
ing=20
> creation. Note that I only timed the ::parse related parts, and not anyth=
ing=20
> else.
>=20

If you can not tell the difference when benchmarking.
And the original code in this area is actually easier to read.
Add to that that it can make future optimizations harder, or
future optimizations might break this code.
(Modifying a const QString. Suppose QString add future optimizations
to identify identical strings. My understanding of Qt is that it
copies on modification. In future the compiler and Qt could together
decide that QString("file") is an atomic constant.
And we might end up needing the g++ option -fwritable-strings)
We should really try to keep stuff as high level as possible.

> (Ponders patching Qt lower to add some sort of a "lower!()")

Maybe, that is the right way.
Only time will tell :-)

/RogerL

=2D-=20
Roger Larsson
Skellefte=E5
Sweden