Go to file
Marc Mutz c311815592 QTranslator: re-use 'realname' capacity in find_translation()
For almost the whole of its life time, 'realname' has the same
prefix, but the old code used the same string-builder expression
to construct it over and over again. If QStringBuilder would
re-use the capacity of the LHS object, that would boil down to
just a bit more copying of characters than necessary. But
assigning a QStringBuilder expression to a QString works by
implicit conversion of the QStringBuilder expression to a
QString, followed by move-assigning the new QString into the
old.

The new code keeps the common prefix around, resetting
'realname' to that prefix with truncate, only appending the
varying suffixes. In this way, one memory allocation per
assignment is saved (ignoring a potentially required capacity
increase in one of the appends here), and also some out-of-line
QString dtor calls, since op+=(QString&, QStringBuilder...)
doesn't create a temporary QString.

Also saves ~1KiB in text size on optimized GCC 4.9 Linux AMD64
builds.

Change-Id: I0872a69c9111d7218567f06f8fefb010f2430532
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-11 18:37:53 +00:00
bin syncqt.pl: say "ERROR" when it's an error 2015-12-08 06:32:24 +00:00
config.tests Silence cl.exe warning about -arch:SSE2 being unknown in 64-bit builds 2015-12-05 00:10:35 +00:00
dist Update the Qt 5.5.1 changelog for qtbase 2015-09-23 06:49:28 +00:00
doc Merge remote-tracking branch 'origin/5.6' into dev 2016-01-08 12:35:24 +01:00
examples Merge remote-tracking branch 'origin/5.6' into dev 2015-12-18 08:37:31 +01:00
lib Purge all fonts 2015-08-18 19:59:14 +00:00
mkspecs Merge remote-tracking branch 'origin/5.6' into dev 2016-01-08 12:35:24 +01:00
qmake Merge remote-tracking branch 'origin/5.6' into dev 2016-01-08 12:35:24 +01:00
src QTranslator: re-use 'realname' capacity in find_translation() 2016-01-11 18:37:53 +00:00
tests Merge remote-tracking branch 'origin/5.6' into dev 2016-01-08 12:35:24 +01:00
tools Merge remote-tracking branch 'origin/5.6' into dev 2015-12-18 08:37:31 +01:00
util Move CasexTraits from qstring.cpp to qunicodetables_p.h 2015-11-16 14:34:04 +00:00
.gitattributes Update the git-archive export options 2012-09-07 15:39:31 +02:00
.gitignore rewrite qtAddToolEnv() 2016-01-08 09:36:13 +00:00
.qmake.conf Merge remote-tracking branch 'origin/5.6' into dev 2015-10-23 14:45:03 +02:00
.tag Update the git-archive export options 2012-09-07 15:39:31 +02:00
configure Don't write absolute TargetSpec/HostSpec paths to qt.conf 2015-12-10 07:23:00 +00:00
configure.bat Move the official Qt version from qglobal.h to .qmake.conf 2015-10-14 20:12:57 +00:00
header.BSD Updated BSD licensed file headers 2015-02-15 07:41:17 +00:00
header.COMM Add header template for commercial only modules 2015-10-19 10:37:18 +00:00
header.FDL Update copyright headers 2015-02-11 06:49:51 +00:00
header.LGPL3 Update copyright headers 2015-02-11 06:49:51 +00:00
header.LGPL3-COMM Update copyright headers 2015-02-11 06:49:51 +00:00
header.LGPL21 Update copyright headers 2015-02-11 06:49:51 +00:00
header.LGPL-ONLY Update copyright headers 2015-02-11 06:49:51 +00:00
INSTALL Doc: Update links in INSTALL file 2015-02-16 09:06:41 +00:00
LGPL_EXCEPTION.txt Update copyright headers 2015-02-11 06:49:51 +00:00
LICENSE.FDL Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
LICENSE.GPLv3 fix up license references 2015-08-13 11:13:09 +00:00
LICENSE.LGPLv3 fix up license references 2015-08-13 11:13:09 +00:00
LICENSE.LGPLv21 Update copyright headers 2015-02-11 06:49:51 +00:00
LICENSE.PREVIEW.COMMERCIAL Update copyright headers 2015-02-11 06:49:51 +00:00
qtbase.pro Merge remote-tracking branch 'origin/5.6' into dev 2015-11-18 09:01:51 +01:00
sync.profile make a proper header-only module for QtZlib 2015-11-17 20:22:17 +00:00