On Monday 27 July 2015 21:42:58 Gunnar Roth wrote:
> But the results show still a 50% better performance for std::vector when
> inserting and 2 times better performance when iteration non const. In the
> other cases QVector is on par with std::vector. So i still say choose
> QVector only when you really need the implicit sharing.

Note that the iteration itself has the exact same performance. The difference 
you're seeing is overhead only.

A sufficiently large vector (which can be as small as 10 items) or sufficiently 
complex action on iteration (a printf, for example) will completely offset the 
overhead.

Both QVector and std::vector from libc++ have the exact same type for the 
iterator and const_iterator

QVector:
    typedef T* iterator;
    typedef const T* const_iterator;

std::vector:
    typedef pointer                                  iterator;
    typedef const_pointer                            const_iterator;

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to