[Development] HEADS-UP: QStringLiteral

Shawn Rutledge Shawn.Rutledge at qt.io
Wed Aug 21 13:21:08 CEST 2019



On 21 Aug 2019, at 12:38, Edward Welbourne <edward.welbourne at qt.io<mailto:edward.welbourne at qt.io>> wrote:

On Tuesday, 20 August 2019 08:56:06 PDT Bogdan Vatra via Development wrote:

All the major frameworks out there (i.e. Java, C#) they have a
single String which does all the magic.

Yes, and those systems are all built with the assumption that client
code doesn't care if every single time anything happens to a string a
fresh copy of it is made.

In Java, String is immutable, and often “interned”, in which case there are no copies of any two strings that have the same bytes.
https://stackoverflow.com/questions/10578984/what-is-java-string-interning

But concatenating multiple immutable strings will make a new one, and the old ones could be garbage if you no longer keep references to them; so there are StringBuilder and StringBuffer, as workarounds to make that faster.  And then the compiler got smarter: https://stackoverflow.com/questions/1532461/stringbuilder-vs-string-concatenation-in-tostring-in-java

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190821/601fdcbd/attachment.html>


More information about the Development mailing list