[Development] QStringRef conversion functions

Konstantin Ritt ritt.ks at gmail.com
Tue Jun 12 02:08:24 CEST 2012


2012/6/12 Thiago Macieira <thiago.macieira at intel.com>:
> On segunda-feira, 11 de junho de 2012 14.54.44, Girish Ramakrishnan wrote:
>> Hi,
>>
>> On Mon, Jun 11, 2012 at 11:38 AM, Keith Gardner
>>
>> <kgardner at zebraimaging.com> wrote:
>> > I was wondering if there would be a possibility of getting some of the
>> > conversion functions that are in QString implemented in QStringRef (toInt,
>> > toFloat, etc...).  The reasoning behind this is that I am using the
>> > QXMLStreamReader to parse an XML file with over 88,704 floating point
>> > values.  I am trying to improve the speed at which the file is parsed and
>> > I
>> > believe one of the bottlenecks is taking an attribute of QStringRef and
>> > copying its data into a QString in order to convert to a float.  I would
>> > prefer that the copy never happen but that would require some more
>> > intelligence be added into the QStringRef class.
>>
>> I am tempted to say it's 5.1 material but it would be nice to see how
>> much gains you are getting out of these new apis and how intrusive the
>> new code is. Can you push your change to gerrit ?
>
> We might be able to remove QStringRef before Qt 5.0 and replace it with plain
> QString.

That is what I'd love to see in 5.0.
Making sub-QStrings as cheap as QStringRef currently is would give us
quite significant performance boost in some common use-cases. Then,
QStringRef definitely should go.

Konstantin



More information about the Development mailing list