yes, in fact especially then, probably due to caching.

2015-01-27 9:47 GMT+01:00 Daniel França <[email protected]>:

> is QVector faster even for sequential access?
> On Tue 27 Jan 2015 at 09:42 Mark Gaiser <[email protected]> wrote:
>
>> On Tue, Jan 27, 2015 at 8:56 AM, Felix morack <[email protected]>
>> wrote:
>>
>>> hello,
>>>
>>>
>>> i recently gained a small, but considerable performance boost by
>>> switching out QList for QVector in some legacy code. This is hindered by
>>> the fact that Qt itself often returns QList, eg with QMap::values().
>>>
>>>
>>> Is there a reason for this? Why arent QVectors used?
>>>
>>>
>>> A somewhat related question, why is there no QList::reserve()? I guess i
>>> see how that function might not make much sense from an algorithmic pov,
>>> but shouldnt it at least be there as a NoOp to make it easy switching
>>> between data structures?
>>>
>>>
>>> best regards,
>>>
>>> As far as i know this is for historic reasons. QList used to be faster
>> then QVector (someone, please correct me if i'm wrong) in the old days, but
>> nowadays (Qt5 era) they prefer QVector over QList. It is as fast or faster
>> then QList in nearly every situation. I vaguely remember there being one
>> exception where QList was faster, but i don't know the exception anymore.
>>
>> _______________________________________________
>> Interest mailing list
>> [email protected]
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to