[Interest] Qtcontainerbench std::vector vs QVector
Allan Sandfeld Jensen
kde at carewolf.com
Tue Jul 28 10:15:39 CEST 2015
On Monday 27 July 2015, Gunnar Roth wrote:
> Hi Constantin.
> Thank you for looking at my benchmark.
>
> > Am 24.07.2015 um 08:57 schrieb Constantin Makshin <cmakshin at 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.
>
To process the values? This in my opinion the most common case, which is why
we have things such as foreach and recommend people to use const references
there
`Allan
More information about the Interest
mailing list