Linked list versus Vector
-
Just found this very nice arcticle "http://www.codeproject.com/Articles/340797/Number-crunching-Why-you-should-never-ever-EVER-us":http://www.codeproject.com/Articles/340797/Number-crunching-Why-you-should-never-ever-EVER-us
The author compares linked list performace versus vector, leaving other containers out of the discussion.
I usually use QList for general porpuse, (I think that's the Qt docs recommend way). Any one care to share opinions about Qt/other containers?
-
There is a fairly comprehensive comparison between different containers in Qt with their strengths and weaknesses:
http://doc-snapshot.qt-project.org/4.8/containers.html -
In Qt5, QVector is recommended over QList, AFAIK. There was a long discussion on dev mailing list about it more or less a month ago. IIRC, QVector has benefitted widely from refactoring and C++11 support, making it the preferred choice. I don't remember any details, though :(
-
"Understand the Qt containers":http://marcmutz.wordpress.com/effective-qt/containers/
"Container Refactor Update":http://lists.qt-project.org/pipermail/development/2012-June/004566.html -
Perfection itself, Lukas, thanks :)
-
Nice links, thanks.
-
From the legendary "Real Programmers":http://www.pbm.com/~lindahl/real.programmers.html article:
"As all Real Programmers know, the only useful data structure is the Array. Strings, Lists, Structures, Sets-- these are all special cases of arrays and can be treated that way just as easily without messing up your programming language with all sorts of complications."
:)
-
Just as any Real Biologist knows, that the only useful life form is a single-celled organism. Mice, humans, dogs - these are all special cases of collection of single-cell organisms, etc. ;)
Nice article, BTW, I have not stumbled upon it before.
-
[quote author="sierdzio" date="1345558670"]Just as any Real Biologist knows, that the only useful life form is a single-celled organism. Mice, humans, dogs - these are all special cases of collection of single-cell organisms, etc. ;)[/quote]
Absolutely :)
-
At Qt Dev Days 2013, there was a talk called 'Apps on Speed' where Millian Wolff from KDAB, showed some performance numbers of QVector vs QList. The conclusion was: always use a QVector, unless you want to insert something in the beginning or in the middle of a list.