[Development] HEADS UP: Don't use QList, use Q_DECLARE_TYPEINFO

Marc Mutz marc.mutz at kdab.com
Mon Jul 13 00:45:00 CEST 2015


On Sunday 12 July 2015 22:55:04 Alejandro Exojo wrote:
> With respect to "less code in your executable", note that in your blog
> post 
> 
> you said:
> > On the positive side, QList is a real memory saver when we talk about the
> > amount of code generated. That is because QList is but a thin wrapper
> > around an internal class that maintains the memory for void*s. This leads
> > to more compact code, because all the memory management code is shared
> > between QLists of different types.
> 
> Does this mean that it changed in Qt5, or am I missing something? Because
> I  still see QVector being a pure header class, while some part of QList
> is in the cpp file.

Since that was written, I have seen QVector create less executable code than 
QList. In theory, QList should expand to less memory, but inefficient QLists, 
what with the heap allocations, probably uses more. Haven't investigated much.

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts



More information about the Development mailing list