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

Sean Harmer sean.harmer at kdab.com
Fri Jul 10 12:36:37 CEST 2015


On Friday 10 Jul 2015 10:32:45 Smith Martin wrote:
> Maybe it's just me, but I'm still not understanding your explanation, and I
> don't think you are answering my question:
> 
> I have a struct C which is bigger than a pointer. I declare QList<C>. Does
> your explanation mean that sometimes (most of the time, in fact), the list
> will become an array of C* instead of an array of C?

Not sometimes. Everytime. As soon as your type is greater than the size of a 
pointer. Hence the extra level of indirection, leading to pointer chasing and 
poor cache performance.

Cheers,

Sean
-- 
Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
KDAB (UK) Ltd, a KDAB Group company
Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
Mobile: +44 (0)7545 140604
KDAB - Qt Experts



More information about the Development mailing list