[Interest] QVectors vs QLists

Konstantin Shegunov kshegunov at gmail.com
Wed May 3 19:53:29 CEST 2017


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.



More information about the Interest mailing list