[Development] HEADS-UP: QStringLiteral

Lars Knoll lars.knoll at qt.io
Thu Aug 22 13:42:29 CEST 2019


> On 21 Aug 2019, at 17:55, Thiago Macieira <thiago.macieira at intel.com> 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.

We could also turn this around: Are we over-optimising here? Do we have the right balance between ease of use and performance? Converting utf8 is a bit more costly than latin1, but would that ever matter in real world use cases? 

Cheers,
Lars




More information about the Development mailing list