PDA

View Full Version : What should be the fastest QList operation?



Momergil
13th June 2014, 14:36
Hello!

This is a quesiton similar to this old one: http://www.qtcentre.org/threads/59278-What-s-the-fastest-QVector-operation?p=263368

What should be the fastest operation to make? (provided that the QList is at least a little big, lets say 100 items or more)


1. QList::reserve()
2. QList::resize()
3. QList::insertAt()

vs.

1. QList::reserve()
2. QList::append() repeatedly, till QList::size() == reserved

wysota
13th June 2014, 15:08
First of all there is no resize() in QList. Second of all when appending QList behaves the same was as QVector. Third of all, RTFM: http://doc.qt.digia.com/qq/qq19-containers.html

Momergil
13th June 2014, 15:36
First of all there is no resize() in QList.

Oh, my mistake! Sorry! :S (I guess I did a confusion because the source code from which I took the question has both a QVector and a QList implemented)


RTFM

Well, that was a documentation I never heard about; thanks for the link! (Btw wouldn't there be any Qt5 changes that could invalidate part of this article?)

Thanks,

Momergil