Hi Constantin.
Thank you for looking at my benchmark.

> Am 24.07.2015 um 08:57 schrieb Constantin Makshin <cmaks...@gmail.com>:
> 
> Well, after looking at the code I can say that the was you wrote this
> benchmark "abuses" the QVector's copy-on-write semantic, making it
> somewhat biased towards std::vector — you use only non-const versions of
> QVector::begin(), QVector::end() and indexing methods. That leads to a
> lot of [obviously non-free] checks for sharing and possible detachment.
> 

Actually imo this is the most important case. Why should i iterate      over a 
vector and not change the values?
If i search in a vector it should be sorted. The sorted case was tested in the 
other tests together with map, but not the const case, so i added that now, but 
there is not much of a difference here.

> A few modifications (see the attachment) made the difference in
> read-only access negligible, in some tests QVector gave slightly better
> results than std::vector. QVector_fwd_it became more than 2x faster.
> 
You also change the order when inserting, so instead of jumping from container 
to container, you insert in a row, but i did that intentionally to minimize L1  
cache effect.
The other iteration tests i added additionally.

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.

Regards,
Gunnar Roth

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

Reply via email to