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

Julien Blanc julien.blanc at nmc-company.com
Thu Jul 16 23:43:14 CEST 2015


Le jeudi 16 juillet 2015 à 23:09 +0200, Gunnar Roth a écrit :


> 
> The vector classes are now very bad in this case. QHash
> is considerable better than any other.
>  
> So I deduce from this test that for a container with up to 100
> elements , std::vector is the best choice , if you want fastest
> lookup, but Vector should be avoided. For larger container QHash
> should be used for best lookup performance.


Unless your vector content changes often, you should use a sorted vector
and a dichotomic search for that use case. Also note that hash are
usually subject to hash collision issues, which may be a security
concern in certain context : i wouldn’t recommend such a container for
general purpose.

Regards,

Julien Blanc 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150716/580902ca/attachment.html>


More information about the Development mailing list