[Development] Container refactor update

André Pönitz andre.poenitz at mathematik.tu-chemnitz.de
Thu Jun 21 00:29:19 CEST 2012


On Wed, Jun 20, 2012 at 08:52:55AM +0200, Marc Mutz wrote:
> Hi Thiago,
> 
> [you knew this would be coming, I don't let you down]
> 
> On Monday June 18 2012, Thiago Macieira wrote:
> > * port QList
> 
> Before actually porting QList (esp. as I take the above to mean
> that QList won't be bound to void* slots anymore): Is there
> than *anything* in QList that QVector doesn't do at least as
> good or that could be ported over to QVector (reserving space
> in front for prepends comes to mind, though I'd argue that code
> that uses this a lot is broken by design anyway).

Inserting in the middle of a container of complex data.  In both
cases O(n), but a simple move of a block of pointers in one case
but not on the other. Same for an append() that triggers
re-allocation actually.

Contrary to popular believe the constant hidden in big-O _does_
matter in practice...

> So, can we please just have the equivalent of template
> <typename T> using QList = QVector<T>; after moving the members
> that QList has but QVector lacks over to QVector?

-1. QList serves a purpose.

> I haven't seen a single Qt developer team (Qt devs not
> excepting) that is fully aware of the performance
> characteristics and memory layout of QList. 

That's an interesting observation that does not _fully_
seem to match mine ;-}

Andre'



More information about the Development mailing list