summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/json
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-11-30 12:31:11 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-12-15 17:50:38 +0000
commit03356fd17a5611911e620dbb65f8bb578fdffafb (patch)
tree0510cce7c2406796c3751ad5f693adea241ff6f3 /tests/auto/corelib/json
parent786984e7e47a63094ad64ec86a4892cc5c0ad6d4 (diff)
QMessageBox: optimize textToCopy string construction
1. Keep 'separator' a QLatin1String. - saves at least two memory allocations - necessitates carrying the \n previously prepended to it around explicitly 2. Start adding to 'textToCopy' with op+= - saves one allocation, costs one -> ±0 - preallocates more capacity than if we started with assignment 3. Collapse three unconditional op+= into one - more efficient usage of QStringBuilder 4. Don't collect button texts in a separate variable, but append to 'textToCopy' directly. - saves at least one memory allocation, probably more since the growth increments of 'textToCopy' should be larger (due to more content) than those of a new variable. Also replace index-based iteration over the buttons with C++11 range-for over a const QList. Avoids the detach that happened previously, due to use of op[] instead of at(), but frankly, I was just too lazy to separate this change. Change-Id: I27a46a6a163c16d773124f140e085325b17ce5d1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'tests/auto/corelib/json')
0 files changed, 0 insertions, 0 deletions