summaryrefslogtreecommitdiffstats
path: root/tests/manual/windowflags
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-01-16 13:17:16 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-01-18 01:31:33 +0100
commit6f6c8d061803a3c89f260fa234388dc27c308bce (patch)
tree9f1c5d1b359471c224d6b0b72dfe6b35cacd7dcb /tests/manual/windowflags
parent9ffcab65629539c0335c78d9896153d9c31f475e (diff)
QVersionNumber: don't allocate in fromString() in the common case
Use QVarLengthArray instead of QList to avoid allocations in the case where the result fits into inline storage. Of course, we now perform one allocation more when we need the QList backend, but a) that should be the rarer case and b) we use 32 (more than InlineSegmentsCount) Prealloc for the QVarLengthArray to reliably skip the first few QList non-reserved capacity jumps (measured to be {4, 12, 28} for back-insertion, not all of which is probably available for append()s) to come out ahead either way. Reviewers may object, saying that we could just reserve(32) the QList, too, but while that would skip over the first few QList reallocations alright, it means we'd be carrying the extra capacity around for the duration of the QVersionNumber's lifetime (unless we'd shrink it at the end, bringing back the additional allocation and that solution back to par compared to this one). As a consequence: [ChangeLog][QtCore][QVersionNumber] Can now be also be constructed from QVarLengthArray. Change-Id: I4016367f64f6cefa6ed9147d33b06636f36b02cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/manual/windowflags')
0 files changed, 0 insertions, 0 deletions