> Sent: Wednesday, May 03, 2017 at 1:53 PM > From: "Konstantin Shegunov" <kshegu...@gmail.com> > To: "Jason H" <jh...@gmx.com> > Cc: "Qt Project" <interest@qt-project.org> > Subject: Re: [Interest] QVectors vs QLists > > I'll throw my 2 cents in, in addition to Sergio's comment on > iterator-based traversing. > > 1) If you don't absolutely need key ordering, I'd suggest a hash table > (e.g. QHash) due to the amortized time lookup/insertion. If you use a > numerical key for the QMap, I'd definitely consider switching to a > hash to offset the cost of the tree rotations, which is also > especially useful (I believe) if the value type is copy-heavy. > > 2) Prefer QVector over QList but not fanatically. If your data's > movable (declared as such) and the size of `void *` (e.g. keeping > implicitly shared classes' instances) then QList should fare just > fine.
Thanks both of you, I am putting effort in to use the classes wisely. Aside fro this keys() thing, I think I'm on point, I only use QMap where I need fast min/max/ordered key lookup, else I'm using QVector. My calls to keys() are few, but they happen on large datasets. It sounds like I should just use QLists for keys() until Qt6. _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest