QVector: always grow exponentially
authorJoão Abecasis <joao.abecasis@nokia.com>
Thu, 16 Feb 2012 22:53:58 +0000 (23:53 +0100)
committerQt by Nokia <qt-info@nokia.com>
Fri, 17 Feb 2012 20:23:20 +0000 (21:23 +0100)
commitfd96115ae8501c2baf591b821bdf6f7d90b62f55
treeca3a0e45a0e998e0c9e54e4ed7e1ef65b353e9e2
parentfb8be9905d5f3216edc3fbb72b8ce1c380737eac
QVector: always grow exponentially

For non-movable types (QTypeInfo<T>::isStatic), QVector would grow the
array linearly, and defer to qAllocMore otherwise. That property,
however, gives no indication as to how the vector will grow.

By forcing additional allocations for growing containers of such types,
this penalized exactly those objects which are more expensive to move.

We now let qAllocMore reign in growth decisions.

Change-Id: I843a89dcdc21d09868c6b62a846a7e1e4548e399
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
src/corelib/tools/qvector.cpp
src/corelib/tools/qvector.h
tests/benchmarks/corelib/tools/qvector/qrawvector.h