[Development] Container refactor update [Caution: Message contains Suspicious URL content]
Thiago Macieira
thiago.macieira at intel.com
Thu Jun 21 11:46:56 CEST 2012
On quinta-feira, 21 de junho de 2012 09.56.39, Mülner, Helmut wrote:
> I measured this programming using MSVC2010 with /Ox and Rational Quantify
> and also the a 3:1 factor. But: QList::append calls new 10000 times,
> QVector::append never calls new but QVectorData::allocate twice and
> QVector::realloc once. If I add f.reserve(10000) in both cases,
> QList::append still call new 10000 times, and QVectorData::allocate is
> still called only twice, and QVector is faster than QList (by a small but
> consistent margin). Without optimization QVectorData::allocate is call 24
> times (for the first case, still 3:1).
Technically, QVector is also calling operator new and if you don't reserve the
size beforehand, then it's probably calling new much more than 10000 times.
The difference is that it's calling the placement operator new, which does not
allocate memory.
QList's performance will be better if your class's (copy) constructor is
expensive.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
Intel Sweden AB - Registration Number: 556189-6027
Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120621/7fc41ffd/attachment.sig>
More information about the Development
mailing list