[Development] HEADS-UP: QStringLiteral

Thiago Macieira thiago.macieira at intel.com
Thu Aug 22 17:16:08 CEST 2019


On Thursday, 22 August 2019 05:49:19 PDT Edward Welbourne wrote:
> The complication is that, unless you have a *very* liberal meaning of "a
> few", that's not the choice you're faced with.  Converting from UTF-8
> sure looks a lot more expensive (from what I've seen of the code) than
> converting from ISO-Latin-1.

It is, but our code is smart. It tries to first do a full SIMD decode of the 
content as if it were US-ASCII and then checks if there's anything non-ASCII 
there. So for UTF-8 input that is *also* US-ASCII, the performance of our 
fromUtf8 should be within 5% of the fromLatin1 performance.

This is implemented for both x86 and AArch64. (Performance numbers for AArch64 
may be different)

> OTOH, if we could bear the heavy burden of using u"..." for strings
> where we care about speed more than size, u8"..." for those where the
> content isn't pure ASCII but we care about size more than speed, and
> accept only ever using plain old C "..."  when its contents are pure
> ASCII, I think we can realistically hope to achieve some significant
> simplifications.

We need to make an assessment of what the C++20 changes mean for u8"" first, 
since it changes from char[] literal to char8_t[] literal. Adding the 
overloads to QString is easy, but we may have places that take a const char*, 
put it in a variable, then pass to a QString. Those will need updating.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products






More information about the Development mailing list