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)
_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to