[Development] Feature Freeze Exception: QStringView
Thiago Macieira
thiago.macieira at intel.com
Fri Feb 3 17:47:38 CET 2017
On sexta-feira, 3 de fevereiro de 2017 13:48:46 PST Kevin Kofler wrote:
> The overhead compared to using QString will be reduced, but only part of it
> (the avoided memory allocation) is really an optimization. The rest of the
> "reduced" overhead is because QString will get the same overhead bloated
> onto it (copying the entire string). So, sure, technically, QStringView will
> have less overhead over QString, but the way you achieved that is
> counterproductive. And all this is only valid for very short strings, longer
> strings will still behave the same as before, except for the overhead of
> the unused SSO array in both cases.
Note how libstdc++ implemented SSO: instead of bit-check and branch,
std::__cxx11::string always keeps a pointer to the beginning of the data, only
that reflects back to itself. Interestingly, that's what QStringData did in
Qt 4.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list