Countering string bloat (addendum)

As last weeks post on countering string bloat has triggered some interest (and a few misunderstandings) here are a few more details on that topic. Nevertheless this isn’t going to be a comprehensive discussion of string handling in Qt (and was never meant to be), there’s plenty of posts and talks on that subject already out there if you want to dig deeper.

This is a companion discussion topic for the original entry at
1 Like

In qt6, is it better to use QUtf8StringView instead of QLatin1StringView? Same literal size, but without the codepage limit.

I have no numbers on that yet, I would expect though that for 7bit ASCII literals QLatin1StringView would still outperform QUtf8StringView as it doesn’t have to consider multi-byte characters (eg. string length is the same as memory size).

For Unicode literals it’s going to be interesting to see how it performs against the other options for runtime operations.