summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-12-25 16:58:47 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-12-29 19:02:18 +0000
commitad74c953998133887ac2362800772e0fa01dd3da (patch)
tree948d81dd181618d01c7cefb56ff15f8d249859b0 /tests
parentdb0453742c7b156ce1d133d7c2c3c5959ff0c9e6 (diff)
Optimize string building in QCommandLineParserPrivate::helpText()
- Don't detach QCoreApplication::arguments() by calling first(), call constFirst() - Use QString foo; foo += initial; instead of QString foo = initial; where 'foo' receives more appends later (does not force an initial capacity that is known to be too small). - Use QStringBuilder more - Don't use QStringLiteral in QStringBuilder expressions - Reserve optionNameList. Its max. size is known ahead of time. - Don't create optionNameStrings for hidden options. The result was never used, they just served as placeholders for the lock-step iteration that followed and wrapped the text. - Don't create a QStringList to join(), append to the result string directly. - Cache the return value of option.valueName(). Not only is this faster, it also saves more than 2KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: Id1d88f3c36a521ac71f3a7436810ed31319077ae Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions