[Development] HEADS-UP: QStringLiteral
Olivier Goffart
olivier at woboq.com
Thu Aug 22 08:25:58 CEST 2019
On 21.08.19 17:55, Thiago Macieira wrote:
> On Wednesday, 21 August 2019 08:18:08 PDT Tor Arne Vestbø wrote:
>>> Oh, the following is nearly the most optimal:
>>>
>>>
>>> test[u"key"] = u"value”;
>>
>>
>> So that would be utf16, can’t we let test["key"] = “value” assume utf8, ie
>> u8”foo” without the explicitness?
>
> We can and already do that. But that's not optimal, since the UTF-8 algorithm
> has a cost.
>
> That's why we are not removing QLatin1String: the Latin1 algorithm is as fast
> as memcpy. The only thing better than that is zero copies.
I'd claim the cost of the conversion is negligible compared to the cost of the
extra allocation. (so in the case above, "..." or u"..." or QL1S("...") makes
no real speed difference, QStringLiteral("...") does)
More information about the Development
mailing list