[Interest] Qtcontainerbench std::vector vs QVector
Gunnar Roth
gunnar.roth at gmx.de
Wed Jul 22 21:20:39 CEST 2015
Hi,
for whom it may concern i post my results for vector iterating using iterator and index plus insert via push_back.
the test code is at https://github.com/gunrot/qtcontainerbench <https://github.com/gunrot/qtcontainerbench> in branch vector. it runs over N containers where N=min(1,100000/countofelements)
on my OS X 10.10.5 xcode 3.6 13 inch retina apple notebook(2013)
Commandline was
LANG=C ./qtcontainerbench testCase_iterate_vector -csv
Time is in ms.
stdvector_fwd_it
5
0,13671875
stdvector_fwd_it
10
0,12890625
stdvector_fwd_it
20
0,126953125
stdvector_fwd_it
40
0,099609375
stdvector_fwd_it
50
0,083984375
stdvector_fwd_it
80
0,095703125
stdvector_fwd_it
100
0,0859375
stdvector_fwd_it
1000
0,072265625
stdvector_fwd_it
10000
0,08203125
stdvector_fwd_it
100000
0,076171875
stdvector_fwd_it
1000000
1,078125
QVector_fwd_it
5
0,23046875
QVector_fwd_it
10
0,20703125
QVector_fwd_it
20
0,23828125
QVector_fwd_it
40
0,234375
QVector_fwd_it
50
0,19921875
QVector_fwd_it
80
0,22265625
QVector_fwd_it
100
0,18359375
QVector_fwd_it
1000
0,1640625
QVector_fwd_it
10000
0,17578125
QVector_fwd_it
100000
0,18359375
QVector_fwd_it
1000000
1,65625
stdvector_fwd_idx
5
0,140625
stdvector_fwd_idx
10
0,107421875
stdvector_fwd_idx
20
0,09375
stdvector_fwd_idx
40
0,107421875
stdvector_fwd_idx
50
0,0947265625
stdvector_fwd_idx
80
0,107421875
stdvector_fwd_idx
100
0,1044921875
stdvector_fwd_idx
1000
0,0771484375
stdvector_fwd_idx
10000
0,0830078125
stdvector_fwd_idx
100000
0,080078125
stdvector_fwd_idx
1000000
1,03125
QVector_fwd_idx
5
0,203125
QVector_fwd_idx
10
0,21484375
QVector_fwd_idx
20
0,21484375
QVector_fwd_idx
40
0,189453125
QVector_fwd_idx
50
0,166015625
QVector_fwd_idx
80
0,16796875
QVector_fwd_idx
100
0,15234375
QVector_fwd_idx
1000
0,146484375
QVector_fwd_idx
10000
0,1796875
QVector_fwd_idx
100000
0,14453125
QVector_fwd_idx
1000000
1,75
stdvector_pushback
5
14
stdvector_pushback
10
11,25
stdvector_pushback
20
9,625
stdvector_pushback
40
7,625
stdvector_pushback
50
7
stdvector_pushback
80
6,75
stdvector_pushback
100
6,4375
stdvector_pushback
1000
5,4375
stdvector_pushback
10000
5,4375
stdvector_pushback
100000
5,6875
stdvector_pushback
1000000
55
QVector_pushback
5
14
QVector_pushback
10
14,5
QVector_pushback
20
13,75
QVector_pushback
40
11,625
QVector_pushback
50
10,375
QVector_pushback
80
11,875
QVector_pushback
100
10,125
QVector_pushback
1000
9,875
QVector_pushback
10000
10
QVector_pushback
100000
10,75
QVector_pushback
1000000
97
My conclusion from this is to use std::vector. Only if i really need the implicit sharing property , because i cannot move, i would choose QVector.
Regards,
Gunnar Roth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150722/99b25367/attachment.html>
More information about the Interest
mailing list